home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 5 code / Lisp Mini-App.sea / Lisp Mini-App / All about the Mini-App.text < prev    next >
MacBinary  |  1992-04-08  |  44.3 KB  |  [TEXT/MWII]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Apr 8 19:02:46 1992, modified Wed Apr 8 19:02:46 1992, creator 'MWII', type ASCII, 44613 bytes "All about the Mini-App.text" , at 0xaec5 441 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MWII]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 1b 41 6c 6c 20 61 62 | 6f 75 74 20 74 68 65 20 |..All ab|out the |
|00000010| 4d 69 6e 69 2d 41 70 70 | 2e 74 65 78 74 00 00 00 |Mini-App|.text...|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 57 49 | 49 01 00 00 00 00 00 00 |.TEXTMWI|I.......|
|00000050| 00 00 00 00 00 ae 45 00 | 00 01 b9 a6 09 2c 16 a6 |......E.|.....,..|
|00000060| 09 2c 16 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.,......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 24 af 00 00 |........|....$...|
|00000080| 61 6c 6c 20 41 62 6f 75 | 74 20 74 68 65 20 6d 69 |all Abou|t the mi|
|00000090| 6e 69 6c 69 73 70 20 61 | 70 70 6c 69 63 61 74 69 |nilisp a|pplicati|
|000000a0| 6f 6e 0d 0d 52 75 62 65 | 6e 20 4b 6c 65 69 6d 61 |on..Rube|n Kleima|
|000000b0| 6e 0d 0d 0d 4d 69 6e 6f | 72 20 65 64 69 74 69 6e |n...Mino|r editin|
|000000c0| 67 20 62 79 20 73 6c 6d | 20 33 2f 31 30 2f 39 32 |g by slm| 3/10/92|
|000000d0| 2e 0d 0d 0d 49 66 20 79 | 6f 75 27 72 65 20 72 65 |....If y|ou're re|
|000000e0| 61 6c 6c 79 20 69 6e 74 | 65 72 65 73 74 65 64 20 |ally int|erested |
|000000f0| 69 6e 20 74 68 65 20 6e | 69 74 74 79 2d 67 72 69 |in the n|itty-gri|
|00000100| 74 74 79 20 0d 64 65 74 | 61 69 6c 73 20 6f 66 20 |tty .det|ails of |
|00000110| 64 65 76 65 6c 6f 70 69 | 6e 67 20 61 20 70 72 6f |developi|ng a pro|
|00000120| 67 72 61 6d 20 75 73 69 | 6e 67 20 4d 43 4c 2c 20 |gram usi|ng MCL, |
|00000130| 0d 74 68 69 73 20 69 73 | 20 79 6f 75 72 20 6f 70 |.this is| your op|
|00000140| 70 6f 72 74 75 6e 69 74 | 79 20 74 6f 20 6c 65 61 |portunit|y to lea|
|00000150| 72 6e 20 62 79 20 64 6f | 69 6e 67 2e 20 0d 57 65 |rn by do|ing. .We|
|00000160| 27 6c 6c 20 64 65 73 63 | 72 69 62 65 20 68 65 72 |'ll desc|ribe her|
|00000170| 65 20 68 6f 77 20 74 6f | 20 62 75 69 6c 64 20 6b |e how to| build k|
|00000180| 65 79 20 66 65 61 74 75 | 72 65 73 20 0d 6f 66 20 |ey featu|res .of |
|00000190| 74 68 65 20 73 61 6d 70 | 6c 65 20 70 72 6f 67 72 |the samp|le progr|
|000001a0| 61 6d 20 4d 69 6e 69 2d | 41 70 70 6c 69 63 61 74 |am Mini-|Applicat|
|000001b0| 69 6f 6e 2e 20 54 68 65 | 20 0d 63 6f 6d 70 6c 65 |ion. The| .comple|
|000001c0| 74 65 20 73 6f 75 72 63 | 65 20 63 6f 64 65 20 66 |te sourc|e code f|
|000001d0| 6f 72 20 74 68 69 73 20 | 70 72 6f 67 72 61 6d 20 |or this |program |
|000001e0| 69 73 20 61 6c 73 6f 20 | 0d 63 6f 6e 74 61 69 6e |is also |.contain|
|000001f0| 65 64 20 6f 6e 20 74 68 | 69 73 20 64 69 73 63 2e |ed on th|is disc.|
|00000200| 0d 0d 4f 75 72 20 73 61 | 6d 70 6c 65 20 61 70 70 |..Our sa|mple app|
|00000210| 6c 69 63 61 74 69 6f 6e | 20 63 6f 6d 62 69 6e 65 |lication| combine|
|00000220| 73 20 73 6f 6d 65 20 6f | 66 20 74 68 65 20 66 65 |s some o|f the fe|
|00000230| 61 74 75 72 65 73 20 0d | 6f 66 20 70 72 6f 67 72 |atures .|of progr|
|00000240| 61 6d 73 20 6c 69 6b 65 | 20 4d 61 63 44 72 61 77 |ams like| MacDraw|
|00000250| 20 61 6e 64 20 48 79 70 | 65 72 43 61 72 64 2e 20 | and Hyp|erCard. |
|00000260| 49 74 73 20 6d 61 69 6e | 20 0d 63 6f 6d 70 6f 6e |Its main| .compon|
|00000270| 65 6e 74 73 20 61 72 65 | 3a 0d 0d a5 20 57 69 6e |ents are|:... Win|
|00000280| 64 6f 77 73 20 69 6e 20 | 77 68 69 63 68 20 74 68 |dows in |which th|
|00000290| 65 20 75 73 65 72 20 63 | 61 6e 20 62 75 69 6c 64 |e user c|an build|
|000002a0| 20 0d 67 72 61 70 68 69 | 63 73 0d 0d a5 20 50 61 | .graphi|cs... Pa|
|000002b0| 6c 65 74 74 65 73 20 66 | 72 6f 6d 20 77 68 69 63 |lettes f|rom whic|
|000002c0| 68 20 74 6f 6f 6c 73 20 | 63 61 6e 20 62 65 20 73 |h tools |can be s|
|000002d0| 65 6c 65 63 74 65 64 20 | 0d 61 6e 64 20 66 72 6f |elected |.and fro|
|000002e0| 6d 20 77 68 69 63 68 20 | 67 72 61 70 68 69 63 20 |m which |graphic |
|000002f0| 6f 62 6a 65 63 74 73 20 | 63 61 6e 20 62 65 20 0d |objects |can be .|
|00000300| 64 72 61 67 67 65 64 20 | 6f 75 74 0d 0d a5 20 41 |dragged |out... A|
|00000310| 20 76 61 72 69 65 74 79 | 20 6f 66 20 67 72 61 70 | variety| of grap|
|00000320| 68 69 63 20 6f 62 6a 65 | 63 74 73 20 28 66 6f 72 |hic obje|cts (for|
|00000330| 20 65 78 61 6d 70 6c 65 | 2c 20 0d 62 75 74 74 6f | example|, .butto|
|00000340| 6e 73 2c 20 66 69 65 6c | 64 73 29 20 74 68 61 74 |ns, fiel|ds) that|
|00000350| 20 63 61 6e 20 62 65 20 | 64 72 61 67 67 65 64 20 | can be |dragged |
|00000360| 66 72 6f 6d 20 0d 74 68 | 65 20 70 61 6c 65 74 74 |from .th|e palett|
|00000370| 65 73 20 74 6f 20 62 75 | 69 6c 64 20 73 6f 6d 65 |es to bu|ild some|
|00000380| 74 68 69 6e 67 20 69 6e | 20 74 68 65 20 0d 77 69 |thing in| the .wi|
|00000390| 6e 64 6f 77 73 0d 0d a5 | 20 4d 65 6e 75 73 20 74 |ndows...| Menus t|
|000003a0| 6f 20 73 69 6d 70 6c 69 | 66 79 20 74 68 65 20 75 |o simpli|fy the u|
|000003b0| 73 65 72 20 69 6e 74 65 | 72 66 61 63 65 0d 0d a5 |ser inte|rface...|
|000003c0| 20 41 6e 20 65 76 65 6e | 74 20 73 79 73 74 65 6d | An even|t system|
|000003d0| 20 74 68 61 74 20 61 70 | 70 72 6f 78 69 6d 61 74 | that ap|proximat|
|000003e0| 65 73 20 0d 48 79 70 65 | 72 43 61 72 64 d5 73 2c |es .Hype|rCard.s,|
|000003f0| 20 69 6e 63 6c 75 64 69 | 6e 67 20 74 68 65 20 61 | includi|ng the a|
|00000400| 62 69 6c 69 74 79 20 74 | 6f 20 77 72 69 74 65 20 |bility t|o write |
|00000410| 0d 73 63 72 69 70 74 73 | 20 66 6f 72 20 6f 62 6a |.scripts| for obj|
|00000420| 65 63 74 73 20 2d 20 61 | 6c 62 65 69 74 20 69 6e |ects - a|lbeit in|
|00000430| 20 4c 69 73 70 0d 0d 59 | 6f 75 20 6d 61 79 20 77 | Lisp..Y|ou may w|
|00000440| 61 6e 74 20 74 6f 20 72 | 75 6e 20 74 68 65 20 61 |ant to r|un the a|
|00000450| 70 70 6c 69 63 61 74 69 | 6f 6e 20 62 65 66 6f 72 |pplicati|on befor|
|00000460| 65 20 6c 65 61 72 6e 69 | 6e 67 20 0d 68 6f 77 20 |e learni|ng .how |
|00000470| 69 74 20 77 61 73 20 62 | 75 69 6c 74 2e 20 20 49 |it was b|uilt. I|
|00000480| 6e 73 74 72 75 63 74 69 | 6f 6e 73 20 66 6f 6c 6c |nstructi|ons foll|
|00000490| 6f 77 20 69 6e 20 22 54 | 6f 20 52 75 6e 20 74 68 |ow in "T|o Run th|
|000004a0| 65 20 0d 41 70 70 6c 69 | 63 61 74 69 6f 6e 2e 22 |e .Appli|cation."|
|000004b0| 20 20 53 74 61 72 74 69 | 6e 67 20 77 69 74 68 20 | Starti|ng with |
|000004c0| 74 68 65 20 73 65 63 74 | 69 6f 6e 20 22 43 72 65 |the sect|ion "Cre|
|000004d0| 61 74 69 6e 67 20 74 68 | 65 20 0d 46 72 61 6d 65 |ating th|e .Frame|
|000004e0| 77 6f 72 6b 2c 22 20 77 | 65 20 73 68 6f 77 20 68 |work," w|e show h|
|000004f0| 6f 77 20 74 6f 20 62 75 | 69 6c 64 20 74 68 65 20 |ow to bu|ild the |
|00000500| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 6e 20 61 |applicat|ion in a|
|00000510| 20 0d 74 6f 70 2d 64 6f | 77 6e 20 6d 61 6e 6e 65 | .top-do|wn manne|
|00000520| 72 2c 20 70 61 79 69 6e | 67 20 61 74 74 65 6e 74 |r, payin|g attent|
|00000530| 69 6f 6e 20 74 6f 20 74 | 68 65 20 66 65 61 74 75 |ion to t|he featu|
|00000540| 72 65 73 20 6f 66 20 0d | 74 68 65 20 64 65 76 65 |res of .|the deve|
|00000550| 6c 6f 70 6d 65 6e 74 20 | 65 6e 76 69 72 6f 6e 6d |lopment |environm|
|00000560| 65 6e 74 20 61 6e 64 20 | 6f 66 20 4c 69 73 70 20 |ent and |of Lisp |
|00000570| 74 68 61 74 20 65 6e 68 | 61 6e 63 65 20 0d 70 72 |that enh|ance .pr|
|00000580| 6f 67 72 61 6d 6d 65 72 | 20 70 72 6f 64 75 63 74 |ogrammer| product|
|00000590| 69 76 69 74 79 20 28 61 | 6e 64 20 65 6e 6a 6f 79 |ivity (a|nd enjoy|
|000005a0| 6d 65 6e 74 29 2e 20 57 | 65 20 63 72 61 66 74 20 |ment). W|e craft |
|000005b0| 74 68 65 20 0d 6b 65 79 | 20 6d 65 74 68 6f 64 73 |the .key| methods|
|000005c0| 20 6f 72 20 66 75 6e 63 | 74 69 6f 6e 73 20 66 6f | or func|tions fo|
|000005d0| 72 20 65 61 63 68 20 61 | 73 70 65 63 74 20 6f 66 |r each a|spect of|
|000005e0| 20 74 68 65 20 0d 61 70 | 70 6c 69 63 61 74 69 6f | the .ap|plicatio|
|000005f0| 6e 2e 20 57 65 20 64 6f | 6e 27 74 20 70 72 6f 76 |n. We do|n't prov|
|00000600| 69 64 65 20 61 20 63 6f | 6d 70 6c 65 74 65 20 65 |ide a co|mplete e|
|00000610| 78 65 67 65 73 69 73 20 | 6f 66 20 0d 74 68 65 20 |xegesis |of .the |
|00000620| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2c 20 62 75 74 |applicat|ion, but|
|00000630| 20 20 74 6f 75 63 68 20 | 6f 6e 20 65 76 65 72 79 | touch |on every|
|00000640| 20 63 6f 6d 70 6f 6e 65 | 6e 74 20 0d 6d 65 6e 74 | compone|nt .ment|
|00000650| 69 6f 6e 65 64 20 61 62 | 6f 76 65 2c 20 69 6d 70 |ioned ab|ove, imp|
|00000660| 6c 65 6d 65 6e 74 69 6e | 67 20 74 68 65 20 6d 61 |lementin|g the ma|
|00000670| 69 6e 20 63 6f 64 65 20 | 66 6f 72 20 74 68 61 74 |in code |for that|
|00000680| 20 0d 66 65 61 74 75 72 | 65 2e 20 0d 0d 74 6f 20 | .featur|e. ..to |
|00000690| 72 75 6e 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |run the |applicat|
|000006a0| 69 6f 6e 0d 0d 54 6f 20 | 72 75 6e 20 74 68 65 20 |ion..To |run the |
|000006b0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2c 20 79 6f 75 |applicat|ion, you|
|000006c0| 20 6e 65 65 64 20 61 20 | 63 6f 70 79 20 6f 66 20 | need a |copy of |
|000006d0| 4d 61 63 69 6e 74 6f 73 | 68 20 0d 43 6f 6d 6d 6f |Macintos|h .Commo|
|000006e0| 6e 20 4c 69 73 70 2c 20 | 56 65 72 73 69 6f 6e 20 |n Lisp, |Version |
|000006f0| 32 2e 30 2c 20 61 76 61 | 69 6c 61 62 6c 65 20 66 |2.0, ava|ilable f|
|00000700| 72 6f 6d 20 0d 41 50 44 | 41 2e 20 4d 43 4c 20 72 |rom .APD|A. MCL r|
|00000710| 75 6e 73 20 69 6e 20 34 | 20 6d 65 67 61 62 79 74 |uns in 4| megabyt|
|00000720| 65 73 2e 0d 0d 54 6f 20 | 72 75 6e 20 74 68 65 20 |es...To |run the |
|00000730| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2c 20 6f 70 65 |applicat|ion, ope|
|00000740| 6e 20 74 68 65 20 66 69 | 6c 65 20 52 65 61 64 20 |n the fi|le Read |
|00000750| 4d 65 20 46 69 72 73 74 | 2e 6c 69 73 70 20 0d 69 |Me First|.lisp .i|
|00000760| 6e 74 6f 20 61 20 74 65 | 78 74 20 77 69 6e 64 6f |nto a te|xt windo|
|00000770| 77 20 69 6e 20 4d 43 4c | 20 61 6e 64 20 72 65 61 |w in MCL| and rea|
|00000780| 64 20 74 68 65 20 69 6e | 73 74 72 75 63 74 69 6f |d the in|structio|
|00000790| 6e 73 2e 20 0d 41 6c 6c | 20 79 6f 75 20 68 61 76 |ns. .All| you hav|
|000007a0| 65 20 74 6f 20 64 6f 20 | 69 73 20 74 6f 20 73 65 |e to do |is to se|
|000007b0| 74 20 75 70 20 74 68 65 | 20 6e 61 6d 65 20 6f 66 |t up the| name of|
|000007c0| 20 74 68 65 20 0d 64 69 | 72 65 63 74 6f 72 79 20 | the .di|rectory |
|000007d0| 77 68 65 72 65 20 79 6f | 75 20 69 6e 73 74 61 6c |where yo|u instal|
|000007e0| 6c 65 64 20 74 68 65 20 | 4d 69 6e 69 2d 41 70 70 |led the |Mini-App|
|000007f0| 6c 69 63 61 74 69 6f 6e | 20 0d 66 6f 6c 64 65 72 |lication| .folder|
|00000800| 20 73 75 70 70 6c 69 65 | 64 20 6f 6e 20 74 68 65 | supplie|d on the|
|00000810| 20 43 44 20 52 4f 4d 20 | 61 6e 64 20 65 76 61 6c | CD ROM |and eval|
|00000820| 75 61 74 65 20 74 68 65 | 20 74 65 78 74 20 0d 77 |uate the| text .w|
|00000830| 69 6e 64 6f 77 2e 20 20 | 54 68 69 73 20 77 69 6c |indow. |This wil|
|00000840| 6c 20 63 61 75 73 65 20 | 74 68 65 20 61 70 70 6c |l cause |the appl|
|00000850| 69 63 61 74 69 6f 6e 20 | 74 6f 20 6c 6f 61 64 20 |ication |to load |
|00000860| 61 6e 64 20 0d 72 75 6e | 2e 0d 0d 54 68 65 20 61 |and .run|...The a|
|00000870| 70 70 6c 69 63 61 74 69 | 6f 6e 20 63 6f 6e 73 69 |pplicati|on consi|
|00000880| 73 74 73 20 6f 66 20 74 | 68 65 20 66 6f 6c 6c 6f |sts of t|he follo|
|00000890| 77 69 6e 67 20 66 69 6c | 65 73 3a 0d 0d 46 69 6c |wing fil|es:..Fil|
|000008a0| 65 20 4e 61 6d 65 09 09 | 09 09 44 65 73 63 72 69 |e Name..|..Descri|
|000008b0| 70 74 69 6f 6e 0d 0d 52 | 65 61 64 20 4d 65 20 46 |ption..R|ead Me F|
|000008c0| 69 72 73 74 2e 6c 69 73 | 70 09 09 09 54 68 65 20 |irst.lis|p...The |
|000008d0| 63 6f 64 65 20 74 68 61 | 74 20 6c 6f 61 64 73 20 |code tha|t loads |
|000008e0| 61 6e 64 20 72 75 6e 73 | 20 09 09 0d 09 09 09 09 |and runs| .......|
|000008f0| 20 20 20 20 20 20 20 20 | 74 68 65 20 61 70 70 6c | |the appl|
|00000900| 69 63 61 74 69 6f 6e 2e | 20 49 74 20 61 6c 73 6f |ication.| It also|
|00000910| 20 69 6e 69 74 69 61 6c | 69 7a 65 73 20 09 09 0d | initial|izes ...|
|00000920| 09 09 09 09 20 20 20 20 | 20 20 20 20 6f 62 6a 65 |.... | obje|
|00000930| 63 74 73 20 6e 65 65 64 | 65 64 20 62 79 20 65 61 |cts need|ed by ea|
|00000940| 63 68 20 72 75 6e 2e 0d | 0d 6d 69 6e 69 2d 61 70 |ch run..|.mini-ap|
|00000950| 70 6c 69 63 61 74 69 6f | 6e 2d 6c 6f 61 64 65 72 |plicatio|n-loader|
|00000960| 2e 6c 69 73 70 09 09 4c | 6f 61 64 73 20 74 68 65 |.lisp..L|oads the|
|00000970| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 63 6f 64 | applica|tion cod|
|00000980| 65 2e 0d 0d 63 6f 6d 70 | 69 6c 65 2d 6d 69 6e 69 |e...comp|ile-mini|
|00000990| 2d 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 6c 69 73 |-applica|tion.lis|
|000009a0| 70 09 09 41 20 66 69 6c | 65 20 77 68 69 63 68 2c |p..A fil|e which,|
|000009b0| 20 77 68 65 6e 20 6c 6f | 61 64 65 64 2c 0d 20 09 | when lo|aded,. .|
|000009c0| 09 09 09 09 72 65 63 6f | 6d 70 69 6c 65 73 20 74 |....reco|mpiles t|
|000009d0| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 0d 0d |he appli|cation..|
|000009e0| 67 6c 6f 62 61 6c 73 2e | 6c 69 73 70 09 09 09 09 |globals.|lisp....|
|000009f0| 44 65 63 6c 61 72 65 73 | 20 61 6c 6c 20 67 6c 6f |Declares| all glo|
|00000a00| 62 61 6c 73 20 75 73 65 | 64 20 69 6e 20 74 68 65 |bals use|d in the|
|00000a10| 0d 20 09 09 09 09 09 61 | 70 70 6c 69 63 61 74 69 |. .....a|pplicati|
|00000a20| 6f 6e 2e 0d 0d 64 72 61 | 77 2d 64 69 61 6c 6f 67 |on...dra|w-dialog|
|00000a30| 2d 63 6c 61 73 73 2e 6c | 69 73 70 09 09 09 54 68 |-class.l|isp...Th|
|00000a40| 65 20 63 6c 61 73 73 20 | 6f 66 20 77 69 6e 64 6f |e class |of windo|
|00000a50| 77 73 20 61 6e 64 20 61 | 6c 6c 0d 20 09 09 09 09 |ws and a|ll. ....|
|00000a60| 09 74 68 65 69 72 20 6d | 65 74 68 6f 64 73 2e 0d |.their m|ethods..|
|00000a70| 0d 70 61 6c 65 74 74 65 | 2d 63 6c 61 73 73 2e 6c |.palette|-class.l|
|00000a80| 69 73 70 09 09 09 54 68 | 65 20 63 6c 61 73 73 20 |isp...Th|e class |
|00000a90| 6f 66 20 70 61 6c 65 74 | 74 65 73 20 61 6e 64 20 |of palet|tes and |
|00000aa0| 61 6c 6c 20 09 09 0d 09 | 09 09 09 20 20 20 20 20 |all ....|... |
|00000ab0| 20 20 20 74 68 65 69 72 | 20 6d 65 74 68 6f 64 73 | their| methods|
|00000ac0| 2e 0d 0d 64 72 61 77 2d | 69 74 65 6d 2d 63 6c 61 |...draw-|item-cla|
|00000ad0| 73 73 2e 6c 69 73 70 09 | 09 09 54 68 65 20 63 6c |ss.lisp.|..The cl|
|00000ae0| 61 73 73 65 73 20 6f 66 | 20 61 6c 6c 20 67 72 61 |asses of| all gra|
|00000af0| 70 68 69 63 0d 20 09 09 | 09 09 09 6f 62 6a 65 63 |phic. ..|...objec|
|00000b00| 74 73 20 61 6e 64 20 61 | 6c 6c 20 74 68 65 69 72 |ts and a|ll their|
|00000b10| 20 6d 65 74 68 6f 64 73 | 2e 0d 0d 6d 65 6e 75 73 | methods|...menus|
|00000b20| 2e 6c 69 73 70 09 09 09 | 09 44 65 66 69 6e 65 73 |.lisp...|.Defines|
|00000b30| 20 74 68 65 20 6d 65 6e | 75 73 20 61 6e 64 20 6d | the men|us and m|
|00000b40| 65 6e 75 20 09 09 0d 09 | 09 09 09 20 20 20 20 20 |enu ....|... |
|00000b50| 20 20 20 69 74 65 6d 73 | 20 75 73 65 64 20 62 79 | items| used by|
|00000b60| 20 74 68 69 73 20 61 70 | 70 6c 69 63 61 74 69 6f | this ap|plicatio|
|00000b70| 6e 2c 20 09 09 09 0d 09 | 09 09 20 20 20 20 20 20 |n, .....|.. |
|00000b80| 20 20 20 20 20 20 20 20 | 20 20 61 73 20 77 65 6c | | as wel|
|00000b90| 6c 20 61 73 20 74 68 65 | 20 66 75 6e 63 74 69 6f |l as the| functio|
|00000ba0| 6e 73 20 74 68 65 79 20 | 09 09 09 09 0d 09 09 20 |ns they |....... |
|00000bb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000bc0| 20 20 20 20 20 20 20 69 | 6e 76 6f 6b 65 2e 0d 0d | i|nvoke...|
|00000bd0| 64 65 66 61 75 6c 74 2d | 68 61 6e 64 6c 65 72 73 |default-|handlers|
|00000be0| 2e 6c 69 73 70 09 09 09 | 44 65 66 69 6e 65 73 20 |.lisp...|Defines |
|00000bf0| 74 68 65 20 64 65 66 61 | 75 6c 74 20 62 65 68 61 |the defa|ult beha|
|00000c00| 76 69 6f 72 20 6f 66 0d | 20 09 09 09 09 09 74 68 |vior of.| .....th|
|00000c10| 65 20 48 79 70 65 72 43 | 61 72 64 2d 6c 69 6b 65 |e HyperC|ard-like|
|00000c20| 20 73 63 72 69 70 74 0d | 20 09 09 09 09 20 20 20 | script.| .... |
|00000c30| 20 20 20 20 20 68 61 6e | 64 6c 65 72 73 2c 20 6c | han|dlers, l|
|00000c40| 69 6b 65 20 4d 6f 75 73 | 65 44 6f 77 6e 2e 0d 0d |ike Mous|eDown...|
|00000c50| 75 74 69 6c 69 74 69 65 | 73 2e 6c 69 73 70 09 09 |utilitie|s.lisp..|
|00000c60| 09 09 55 74 69 6c 69 74 | 79 20 66 75 6e 63 74 69 |..Utilit|y functi|
|00000c70| 6f 6e 73 20 75 73 65 64 | 20 09 09 09 0d 09 09 09 |ons used| .......|
|00000c80| 09 20 20 20 20 20 20 20 | 20 74 68 72 6f 75 67 68 |. | through|
|00000c90| 6f 75 74 2e 0d 0d 72 65 | 73 6f 75 72 63 65 73 09 |out...re|sources.|
|00000ca0| 09 09 09 43 6f 6e 74 61 | 69 6e 73 20 61 20 66 65 |...Conta|ins a fe|
|00000cb0| 77 20 72 65 73 6f 75 72 | 63 65 73 20 28 66 6f 72 |w resour|ces (for|
|00000cc0| 0d 09 09 09 09 09 65 78 | 61 6d 70 6c 65 2c 20 69 |......ex|ample, i|
|00000cd0| 63 6f 6e 73 29 2e 0d 0d | 0d 43 72 65 61 74 69 6e |cons)...|.Creatin|
|00000ce0| 67 20 54 68 65 20 46 72 | 61 6d 65 77 6f 72 6b 0d |g The Fr|amework.|
|00000cf0| 0d 41 73 20 77 65 20 62 | 65 67 69 6e 20 74 6f 20 |.As we b|egin to |
|00000d00| 77 72 69 74 65 20 6f 75 | 72 20 61 70 70 6c 69 63 |write ou|r applic|
|00000d10| 61 74 69 6f 6e 2c 20 77 | 65 20 6f 70 65 6e 20 61 |ation, w|e open a|
|00000d20| 20 4d 43 4c 20 0d 74 65 | 78 74 20 64 6f 63 75 6d | MCL .te|xt docum|
|00000d30| 65 6e 74 20 69 6e 20 77 | 68 69 63 68 20 74 6f 20 |ent in w|hich to |
|00000d40| 65 6e 74 65 72 20 61 6e | 64 20 73 61 76 65 20 74 |enter an|d save t|
|00000d50| 68 65 20 63 6f 64 65 2e | 20 54 6f 20 0d 64 6f 20 |he code.| To .do |
|00000d60| 74 68 69 73 2c 20 67 6f | 20 74 6f 20 74 68 65 20 |this, go| to the |
|00000d70| 46 69 6c 65 20 6d 65 6e | 75 20 61 6e 64 20 63 68 |File men|u and ch|
|00000d80| 6f 6f 73 65 20 4e 65 77 | 2e 20 41 20 0d 64 6f 63 |oose New|. A .doc|
|00000d90| 75 6d 65 6e 74 20 63 61 | 6c 6c 65 64 20 4e 65 77 |ument ca|lled New|
|00000da0| 20 77 69 6c 6c 20 62 65 | 20 6f 70 65 6e 65 64 2e | will be| opened.|
|00000db0| 20 0d 0d 57 65 20 77 69 | 6c 6c 20 72 75 6e 20 6f | ..We wi|ll run o|
|00000dc0| 75 72 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 62 |ur appli|cation b|
|00000dd0| 79 20 63 61 6c 6c 69 6e | 67 20 74 68 65 20 66 75 |y callin|g the fu|
|00000de0| 6e 63 74 69 6f 6e 20 0d | 73 74 61 72 74 2d 61 70 |nction .|start-ap|
|00000df0| 70 6c 69 63 61 74 69 6f | 6e 2c 20 77 68 69 63 68 |plicatio|n, which|
|00000e00| 20 77 69 6c 6c 20 62 72 | 69 6e 67 20 75 70 20 74 | will br|ing up t|
|00000e10| 68 65 20 6e 65 63 65 73 | 73 61 72 79 20 0d 6d 65 |he neces|sary .me|
|00000e20| 6e 75 73 20 61 6e 64 20 | 64 69 73 70 6c 61 79 20 |nus and |display |
|00000e30| 61 20 67 72 65 65 74 69 | 6e 67 2e 20 54 79 70 65 |a greeti|ng. Type|
|00000e40| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 69 | the fol|lowing i|
|00000e50| 6e 74 6f 20 0d 6f 75 72 | 20 65 6d 70 74 79 20 64 |nto .our| empty d|
|00000e60| 6f 63 75 6d 65 6e 74 3a | 0d 0d 28 64 65 66 75 6e |ocument:|..(defun|
|00000e70| 20 73 74 61 72 74 2d 61 | 70 70 6c 69 63 61 74 69 | start-a|pplicati|
|00000e80| 6f 6e 20 28 29 0d 20 20 | 28 77 68 65 6e 20 28 77 |on (). |(when (w|
|00000e90| 65 6c 63 6f 6d 65 2d 61 | 63 63 65 70 74 65 64 3f |elcome-a|ccepted?|
|00000ea0| 29 20 3b 20 44 69 73 70 | 6c 61 79 20 77 65 6c 63 |) ; Disp|lay welc|
|00000eb0| 6f 6d 65 20 6d 65 73 73 | 61 67 65 0d 20 20 20 20 |ome mess|age. |
|00000ec0| 28 73 68 6f 77 2d 6d 65 | 6e 75 73 29 20 20 20 20 |(show-me|nus) |
|00000ed0| 20 20 20 20 20 20 20 20 | 3b 20 49 6e 69 74 69 61 | |; Initia|
|00000ee0| 6c 69 7a 65 20 74 68 65 | 20 6d 65 6e 75 62 61 72 |lize the| menubar|
|00000ef0| 0d 20 20 20 20 28 70 72 | 69 6e 74 20 d2 57 65 6c |. (pr|int .Wel|
|00000f00| 63 6f 6d 65 21 d3 29 29 | 29 20 20 20 20 3b 20 50 |come!.))|) ; P|
|00000f10| 72 69 6e 74 20 67 72 65 | 65 74 69 6e 67 0d 0d 59 |rint gre|eting..Y|
|00000f20| 6f 75 20 63 61 6e 20 62 | 65 67 69 6e 20 65 61 63 |ou can b|egin eac|
|00000f30| 68 20 6c 69 6e 65 20 77 | 69 74 68 20 61 20 74 61 |h line w|ith a ta|
|00000f40| 62 2c 20 61 6e 64 20 74 | 68 65 20 65 64 69 74 6f |b, and t|he edito|
|00000f50| 72 20 77 69 6c 6c 20 0d | 61 75 74 6f 6d 61 74 69 |r will .|automati|
|00000f60| 63 61 6c 6c 79 20 69 6e | 64 65 6e 74 20 79 6f 75 |cally in|dent you|
|00000f70| 72 20 63 6f 64 65 20 74 | 6f 20 74 68 65 20 61 70 |r code t|o the ap|
|00000f80| 70 72 6f 70 72 69 61 74 | 65 20 0d 6c 65 76 65 6c |propriat|e .level|
|00000f90| 2e 20 54 68 65 20 64 65 | 66 75 6e 20 66 75 6e 63 |. The de|fun func|
|00000fa0| 74 69 6f 6e 20 69 73 20 | 68 6f 77 20 79 6f 75 20 |tion is |how you |
|00000fb0| 64 65 66 69 6e 65 20 61 | 20 66 75 6e 63 74 69 6f |define a| functio|
|00000fc0| 6e 2e 20 0d 54 68 69 73 | 20 63 6f 6e 73 69 73 74 |n. .This| consist|
|00000fd0| 73 20 6f 66 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |s of a f|unction |
|00000fe0| 6e 61 6d 65 20 28 66 69 | 72 73 74 20 61 72 67 75 |name (fi|rst argu|
|00000ff0| 6d 65 6e 74 29 2c 20 61 | 20 0d 6c 69 73 74 20 74 |ment), a| .list t|
|00001000| 68 61 74 20 73 70 65 63 | 69 66 69 65 73 20 74 68 |hat spec|ifies th|
|00001010| 65 20 61 72 67 75 6d 65 | 6e 74 73 20 61 73 73 75 |e argume|nts assu|
|00001020| 6d 65 64 20 62 79 20 74 | 68 65 20 0d 66 75 6e 63 |med by t|he .func|
|00001030| 74 69 6f 6e 20 28 73 65 | 63 6f 6e 64 20 61 72 67 |tion (se|cond arg|
|00001040| 75 6d 65 6e 74 2c 20 61 | 6c 73 6f 20 6b 6e 6f 77 |ument, a|lso know|
|00001050| 6e 20 61 73 20 74 68 65 | 20 d2 6c 61 6d 62 64 61 |n as the| .lambda|
|00001060| 20 0d 6c 69 73 74 d3 29 | 2c 20 61 6e 64 20 61 6e | .list.)|, and an|
|00001070| 79 20 6e 75 6d 62 65 72 | 20 6f 66 20 4c 69 73 70 |y number| of Lisp|
|00001080| 20 65 78 70 72 65 73 73 | 69 6f 6e 73 20 28 72 65 | express|ions (re|
|00001090| 73 74 20 6f 66 20 0d 61 | 72 67 75 6d 65 6e 74 73 |st of .a|rguments|
|000010a0| 2c 20 61 6c 73 6f 20 6b | 6e 6f 77 6e 20 61 73 20 |, also k|nown as |
|000010b0| 74 68 65 20 62 6f 64 79 | 29 2e 20 45 76 61 6c 75 |the body|). Evalu|
|000010c0| 61 74 69 6e 67 20 74 68 | 65 20 0d 66 75 6e 63 74 |ating th|e .funct|
|000010d0| 69 6f 6e 20 72 65 74 75 | 72 6e 73 20 74 68 65 20 |ion retu|rns the |
|000010e0| 76 61 6c 75 65 20 6f 66 | 20 74 68 65 20 6c 61 73 |value of| the las|
|000010f0| 74 20 65 78 70 72 65 73 | 73 69 6f 6e 20 69 6e 20 |t expres|sion in |
|00001100| 74 68 65 20 0d 62 6f 64 | 79 2e 20 49 6e 20 73 74 |the .bod|y. In st|
|00001110| 61 72 74 2d 61 70 70 6c | 69 63 61 74 69 6f 6e 2c |art-appl|ication,|
|00001120| 20 74 68 65 20 6c 61 6d | 62 64 61 20 6c 69 73 74 | the lam|bda list|
|00001130| 20 68 61 73 20 6e 6f 74 | 68 69 6e 67 20 0d 69 6e | has not|hing .in|
|00001140| 20 69 74 2c 20 73 6f 20 | 74 68 65 20 66 75 6e 63 | it, so |the func|
|00001150| 74 69 6f 6e 20 64 6f 65 | 73 20 6e 6f 74 20 74 61 |tion doe|s not ta|
|00001160| 6b 65 20 61 6e 79 20 61 | 72 67 75 6d 65 6e 74 73 |ke any a|rguments|
|00001170| 2e 20 54 68 65 20 0d 62 | 6f 64 79 20 63 6f 6e 73 |. The .b|ody cons|
|00001180| 69 73 74 73 20 6f 66 20 | 61 20 63 6f 6e 64 69 74 |ists of |a condit|
|00001190| 69 6f 6e 61 6c 20 65 78 | 70 72 65 73 73 69 6f 6e |ional ex|pression|
|000011a0| 20 74 68 61 74 20 63 61 | 6c 6c 73 20 0d 74 68 65 | that ca|lls .the|
|000011b0| 20 66 75 6e 63 74 69 6f | 6e 20 77 65 6c 63 6f 6d | functio|n welcom|
|000011c0| 65 2d 61 63 63 65 70 74 | 65 64 3f 20 61 6e 64 20 |e-accept|ed? and |
|000011d0| 63 61 6c 6c 73 20 73 68 | 6f 77 2d 0d 6d 65 6e 75 |calls sh|ow-.menu|
|000011e0| 73 20 69 66 20 74 68 61 | 74 20 66 75 6e 63 74 69 |s if tha|t functi|
|000011f0| 6f 6e 20 72 65 74 75 72 | 6e 73 20 61 20 76 61 6c |on retur|ns a val|
|00001200| 75 65 20 6f 74 68 65 72 | 20 74 68 61 6e 20 4e 49 |ue other| than NI|
|00001210| 4c 2e 20 0d 41 6c 6c 20 | 6c 69 6e 65 73 20 62 65 |L. .All |lines be|
|00001220| 67 69 6e 6e 69 6e 67 20 | 77 69 74 68 20 61 20 73 |ginning |with a s|
|00001230| 65 6d 69 63 6f 6c 6f 6e | 20 61 72 65 20 63 6f 6d |emicolon| are com|
|00001240| 6d 65 6e 74 73 2e 0d 0d | 54 6f 20 63 6f 6d 70 69 |ments...|To compi|
|00001250| 6c 65 20 73 74 61 72 74 | 2d 61 70 70 6c 69 63 61 |le start|-applica|
|00001260| 74 69 6f 6e 2c 20 73 65 | 6c 65 63 74 20 74 68 65 |tion, se|lect the|
|00001270| 20 64 65 66 69 6e 69 74 | 69 6f 6e 20 0d 77 69 74 | definit|ion .wit|
|00001280| 68 20 74 68 65 20 6d 6f | 75 73 65 20 61 6e 64 20 |h the mo|use and |
|00001290| 63 68 6f 6f 73 65 20 45 | 76 61 6c 20 53 65 6c 65 |choose E|val Sele|
|000012a0| 63 74 69 6f 6e 20 66 72 | 6f 6d 20 74 68 65 20 0d |ction fr|om the .|
|000012b0| 45 76 61 6c 20 6d 65 6e | 75 2e 20 54 68 65 20 63 |Eval men|u. The c|
|000012c0| 6f 6d 70 69 6c 65 72 20 | 77 69 6c 6c 20 70 72 69 |ompiler |will pri|
|000012d0| 6e 74 20 6f 75 74 20 61 | 20 77 61 72 6e 69 6e 67 |nt out a| warning|
|000012e0| 20 69 6e 20 74 68 65 20 | 0d 4c 69 73 74 65 6e 65 | in the |.Listene|
|000012f0| 72 20 74 6f 20 74 68 65 | 20 65 66 66 65 63 74 20 |r to the| effect |
|00001300| 74 68 61 74 20 77 65 6c | 63 6f 6d 65 2d 61 63 63 |that wel|come-acc|
|00001310| 65 70 74 65 64 3f 20 61 | 6e 64 20 0d 73 68 6f 77 |epted? a|nd .show|
|00001320| 2d 6d 65 6e 75 73 20 61 | 72 65 20 75 6e 64 65 66 |-menus a|re undef|
|00001330| 69 6e 65 64 2e 20 4c 69 | 73 70 20 77 61 73 20 74 |ined. Li|sp was t|
|00001340| 6f 6c 65 72 61 6e 74 3a | 20 20 69 74 20 0d 63 6f |olerant:| it .co|
|00001350| 75 6c 64 20 68 61 76 65 | 20 67 69 76 65 6e 20 79 |uld have| given y|
|00001360| 6f 75 20 61 6e 20 65 72 | 72 6f 72 21 20 20 44 6f |ou an er|ror! Do|
|00001370| 6e d5 74 20 77 6f 72 72 | 79 20 61 62 6f 75 74 20 |n.t worr|y about |
|00001380| 74 68 69 73 3a 20 0d 77 | 68 65 6e 20 79 6f 75 20 |this: .w|hen you |
|00001390| 64 65 66 69 6e 65 20 74 | 68 6f 73 65 20 66 75 6e |define t|hose fun|
|000013a0| 63 74 69 6f 6e 73 2c 20 | 65 76 65 72 79 74 68 69 |ctions, |everythi|
|000013b0| 6e 67 20 77 69 6c 6c 20 | 62 65 20 6f 6b 2e 20 0d |ng will |be ok. .|
|000013c0| 4e 6f 77 20 73 61 76 65 | 20 79 6f 75 72 20 74 65 |Now save| your te|
|000013d0| 78 74 20 62 79 20 63 68 | 6f 6f 73 69 6e 67 20 53 |xt by ch|oosing S|
|000013e0| 61 76 65 20 41 73 2e 2e | 2e 20 66 72 6f 6d 20 74 |ave As..|. from t|
|000013f0| 68 65 20 46 69 6c 65 20 | 0d 6d 65 6e 75 2e 0d 0d |he File |.menu...|
|00001400| 4f 75 72 20 77 65 6c 63 | 6f 6d 65 20 64 69 61 6c |Our welc|ome dial|
|00001410| 6f 67 20 77 69 6c 6c 20 | 64 69 73 70 6c 61 79 20 |og will |display |
|00001420| 61 20 73 74 72 69 6e 67 | 20 69 64 65 6e 74 69 66 |a string| identif|
|00001430| 79 69 6e 67 20 0d 74 68 | 65 20 61 70 70 6c 69 63 |ying .th|e applic|
|00001440| 61 74 69 6f 6e 20 61 6e | 64 20 67 69 76 65 20 74 |ation an|d give t|
|00001450| 68 65 20 75 73 65 72 20 | 61 6e 20 6f 70 70 6f 72 |he user |an oppor|
|00001460| 74 75 6e 69 74 79 20 74 | 6f 20 0d 63 61 6e 63 65 |tunity t|o .cance|
|00001470| 6c 2e 20 54 68 69 73 20 | 69 73 20 73 74 72 61 69 |l. This |is strai|
|00001480| 67 68 74 66 6f 72 77 61 | 72 64 20 77 69 74 68 20 |ghtforwa|rd with |
|00001490| 74 68 65 20 70 72 65 64 | 65 66 69 6e 65 64 20 0d |the pred|efined .|
|000014a0| 66 75 6e 63 74 69 6f 6e | 20 79 2d 6f 72 2d 6e 2d |function| y-or-n-|
|000014b0| 64 69 61 6c 6f 67 2e 20 | 45 6e 74 65 72 20 74 68 |dialog. |Enter th|
|000014c0| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 64 65 66 69 |e follow|ing defi|
|000014d0| 6e 69 74 69 6f 6e 20 0d | 69 6e 74 6f 20 79 6f 75 |nition .|into you|
|000014e0| 72 20 74 65 78 74 20 77 | 69 6e 64 6f 77 3a 0d 0d |r text w|indow:..|
|000014f0| 28 64 65 66 75 6e 20 77 | 65 6c 63 6f 6d 65 2d 61 |(defun w|elcome-a|
|00001500| 63 63 65 70 74 65 64 3f | 20 28 29 0d 20 20 28 79 |ccepted?| (). (y|
|00001510| 2d 6f 72 2d 6e 2d 64 69 | 61 6c 6f 67 20 22 57 65 |-or-n-di|alog "We|
|00001520| 6c 63 6f 6d 65 20 54 6f | 20 4d 79 20 41 70 70 2e |lcome To| My App.|
|00001530| 20 52 65 61 64 79 2c 20 | 53 65 74 2c 20 47 6f 3f | Ready, |Set, Go?|
|00001540| 22 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |". | |
|00001550| 20 20 20 3a 79 65 73 2d | 74 65 78 74 20 20 22 47 | :yes-|text "G|
|00001560| 6f 20 44 75 64 65 21 22 | 0d 20 20 20 20 20 20 20 |o Dude!"|. |
|00001570| 20 20 20 20 20 20 20 20 | 20 20 3a 6e 6f 2d 74 65 | | :no-te|
|00001580| 78 74 20 20 20 22 4e 6f | 70 65 22 29 29 0d 0d 79 |xt "No|pe"))..y|
|00001590| 2d 6f 72 2d 6e 2d 64 69 | 61 6c 6f 67 20 61 63 63 |-or-n-di|alog acc|
|000015a0| 65 70 74 73 20 61 73 20 | 69 74 73 20 66 69 72 73 |epts as |its firs|
|000015b0| 74 20 61 72 67 75 6d 65 | 6e 74 20 6f 75 72 20 0d |t argume|nt our .|
|000015c0| 6d 65 73 73 61 67 65 2c | 20 61 6e 64 20 6f 70 74 |message,| and opt|
|000015d0| 69 6f 6e 61 6c 20 6b 65 | 79 77 6f 72 64 20 61 72 |ional ke|yword ar|
|000015e0| 67 75 6d 65 6e 74 73 20 | 63 61 6c 6c 65 64 20 3a |guments |called :|
|000015f0| 79 65 73 2d 0d 74 65 78 | 74 20 61 6e 64 20 3a 6e |yes-.tex|t and :n|
|00001600| 6f 2d 74 65 78 74 20 61 | 72 65 20 61 73 73 69 67 |o-text a|re assig|
|00001610| 6e 65 64 20 74 68 65 20 | 76 61 6c 75 65 73 20 d2 |ned the |values .|
|00001620| 47 6f 20 44 75 64 65 21 | d3 20 0d 61 6e 64 20 22 |Go Dude!|. .and "|
|00001630| 4e 6f 70 65 2c 22 20 72 | 65 73 70 65 63 74 69 76 |Nope," r|espectiv|
|00001640| 65 6c 79 2e 20 54 68 65 | 20 6c 61 74 74 65 72 20 |ely. The| latter |
|00001650| 61 72 65 20 74 68 65 20 | 74 65 78 74 20 0d 61 73 |are the |text .as|
|00001660| 73 69 67 6e 65 64 20 74 | 6f 20 62 75 74 74 6f 6e |signed t|o button|
|00001670| 73 20 6f 6e 20 74 68 65 | 20 77 65 6c 63 6f 6d 65 |s on the| welcome|
|00001680| 20 64 69 61 6c 6f 67 2e | 20 53 69 6e 63 65 20 74 | dialog.| Since t|
|00001690| 68 65 20 0d 63 61 6c 6c | 20 74 6f 20 79 2d 6f 72 |he .call| to y-or|
|000016a0| 2d 6e 2d 64 69 61 6c 6f | 67 20 64 6f 65 73 20 6e |-n-dialo|g does n|
|000016b0| 6f 74 20 64 65 70 65 6e | 64 20 6f 6e 20 61 6e 79 |ot depen|d on any|
|000016c0| 20 0d 76 61 72 69 61 62 | 6c 65 73 2c 20 77 65 20 | .variab|les, we |
|000016d0| 63 61 6e 20 69 6d 6d 65 | 64 69 61 74 65 6c 79 20 |can imme|diately |
|000016e0| 74 65 73 74 20 77 65 6c | 63 6f 6d 65 2d 0d 61 63 |test wel|come-.ac|
|000016f0| 63 65 70 74 65 64 3f 20 | 62 79 20 73 65 6c 65 63 |cepted? |by selec|
|00001700| 74 69 6e 67 20 74 68 65 | 20 74 65 78 74 20 63 6f |ting the| text co|
|00001710| 6e 74 61 69 6e 69 6e 67 | 20 74 68 65 20 63 61 6c |ntaining| the cal|
|00001720| 6c 20 74 6f 20 0d 79 2d | 6f 72 2d 6e 2d 64 69 61 |l to .y-|or-n-dia|
|00001730| 6c 6f 67 20 61 6e 64 20 | 74 68 65 6e 20 63 68 6f |log and |then cho|
|00001740| 6f 73 69 6e 67 20 45 76 | 61 6c 20 53 65 6c 65 63 |osing Ev|al Selec|
|00001750| 74 69 6f 6e 20 66 72 6f | 6d 20 0d 74 68 65 20 45 |tion fro|m .the E|
|00001760| 76 61 6c 20 6d 65 6e 75 | 2e 20 54 68 65 20 64 69 |val menu|. The di|
|00001770| 61 6c 6f 67 20 73 68 6f | 75 6c 64 20 62 65 20 73 |alog sho|uld be s|
|00001780| 68 6f 77 6e 2e 20 49 66 | 20 79 6f 75 20 0d 73 65 |hown. If| you .se|
|00001790| 6c 65 63 74 20 74 68 65 | 20 47 6f 20 44 75 64 65 |lect the| Go Dude|
|000017a0| 21 20 62 75 74 74 6f 6e | 2c 20 74 68 65 20 66 75 |! button|, the fu|
|000017b0| 6e 63 74 69 6f 6e 20 73 | 68 6f 75 6c 64 20 72 65 |nction s|hould re|
|000017c0| 74 75 72 6e 20 54 20 0d | 28 4c 69 73 70 d5 73 20 |turn T .|(Lisp.s |
|000017d0| 42 6f 6f 6c 65 61 6e 20 | 66 6f 72 20 74 72 75 65 |Boolean |for true|
|000017e0| 29 2e 20 57 68 65 6e 20 | 79 6f 75 20 65 76 61 6c |). When |you eval|
|000017f0| 75 61 74 65 20 61 6e 79 | 20 0d 65 78 70 72 65 73 |uate any| .expres|
|00001800| 73 69 6f 6e 20 65 69 74 | 68 65 72 20 69 6e 20 74 |sion eit|her in t|
|00001810| 68 65 20 4c 69 73 74 65 | 6e 65 72 20 6f 72 20 69 |he Liste|ner or i|
|00001820| 6e 20 61 20 74 65 78 74 | 20 77 69 6e 64 6f 77 2c |n a text| window,|
|00001830| 20 0d 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 | .the re|sult of |
|00001840| 74 68 65 20 65 76 61 6c | 75 61 74 69 6f 6e 20 69 |the eval|uation i|
|00001850| 73 20 72 65 74 75 72 6e | 65 64 20 69 6e 20 74 68 |s return|ed in th|
|00001860| 65 20 4c 69 73 74 65 6e | 65 72 2e 20 0d 53 65 6c |e Listen|er. .Sel|
|00001870| 65 63 74 20 74 68 65 20 | 47 6f 20 44 75 64 65 21 |ect the |Go Dude!|
|00001880| 20 62 75 74 74 6f 6e 20 | 74 6f 20 73 65 65 20 77 | button |to see w|
|00001890| 68 61 74 d5 73 20 72 65 | 74 75 72 6e 65 64 2e 0d |hat.s re|turned..|
|000018a0| 0d 43 72 65 61 74 69 6e | 67 20 4f 75 72 20 4d 65 |.Creatin|g Our Me|
|000018b0| 6e 75 73 0d 0d 54 68 65 | 20 66 75 6e 63 74 69 6f |nus..The| functio|
|000018c0| 6e 20 73 68 6f 77 2d 6d | 65 6e 75 73 20 69 73 20 |n show-m|enus is |
|000018d0| 69 6e 76 6f 6b 65 64 20 | 62 79 20 73 74 61 72 74 |invoked |by start|
|000018e0| 2d 0d 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 77 68 |-.applic|ation wh|
|000018f0| 65 6e 20 74 68 65 20 77 | 65 6c 63 6f 6d 65 20 6d |en the w|elcome m|
|00001900| 65 73 73 61 67 65 20 69 | 73 20 61 63 63 65 70 74 |essage i|s accept|
|00001910| 65 64 2e 20 49 6e 20 0d | 6f 75 72 20 61 70 70 6c |ed. In .|our appl|
|00001920| 69 63 61 74 69 6f 6e 2c | 20 73 68 6f 77 2d 6d 65 |ication,| show-me|
|00001930| 6e 75 73 20 77 69 6c 6c | 20 65 6c 69 6d 69 6e 61 |nus will| elimina|
|00001940| 74 65 20 74 68 65 20 0d | 6e 6f 72 6d 61 6c 20 4d |te the .|normal M|
|00001950| 43 4c 20 6d 65 6e 75 73 | 20 61 6e 64 20 64 69 73 |CL menus| and dis|
|00001960| 70 6c 61 79 20 61 20 6d | 65 6e 75 20 62 61 72 20 |play a m|enu bar |
|00001970| 77 69 74 68 20 74 68 65 | 20 0d 66 6f 6c 6c 6f 77 |with the| .follow|
|00001980| 69 6e 67 20 6d 65 6e 75 | 73 3a 20 20 74 68 65 20 |ing menu|s: the |
|00001990| 73 74 61 6e 64 61 72 64 | 20 46 69 6c 65 2c 20 45 |standard| File, E|
|000019a0| 64 69 74 2c 20 61 6e 64 | 20 57 69 6e 64 6f 77 20 |dit, and| Window |
|000019b0| 0d 6d 65 6e 75 73 2c 20 | 61 6e 20 4f 70 74 69 6f |.menus, |an Optio|
|000019c0| 6e 73 20 6d 65 6e 75 2c | 20 61 6e 64 20 61 20 6d |ns menu,| and a m|
|000019d0| 65 6e 75 20 74 68 61 74 | 20 70 72 6f 76 69 64 65 |enu that| provide|
|000019e0| 73 20 0d 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 61 |s .infor|mation a|
|000019f0| 62 6f 75 74 20 74 68 65 | 20 63 75 72 72 65 6e 74 |bout the| current|
|00001a00| 6c 79 20 73 65 6c 65 63 | 74 65 64 20 67 72 61 70 |ly selec|ted grap|
|00001a10| 68 69 63 20 0d 6f 62 6a | 65 63 74 2e 20 46 6f 72 |hic .obj|ect. For|
|00001a20| 20 70 75 72 70 6f 73 65 | 73 20 6f 66 20 74 68 69 | purpose|s of thi|
|00001a30| 73 20 64 65 6d 6f 6e 73 | 74 72 61 74 69 6f 6e 2c |s demons|tration,|
|00001a40| 20 77 65 20 77 69 6c 6c | 20 0d 6c 69 6d 69 74 20 | we will| .limit |
|00001a50| 6f 75 72 73 65 6c 76 65 | 73 20 74 6f 20 62 75 69 |ourselve|s to bui|
|00001a60| 6c 64 69 6e 67 20 74 68 | 65 20 46 69 6c 65 20 6d |lding th|e File m|
|00001a70| 65 6e 75 2e 20 4f 75 72 | 20 46 69 6c 65 20 0d 6d |enu. Our| File .m|
|00001a80| 65 6e 75 20 77 69 6c 6c | 20 68 61 76 65 20 4e 65 |enu will| have Ne|
|00001a90| 77 2c 20 43 6c 6f 73 65 | 2c 20 61 6e 64 20 51 75 |w, Close|, and Qu|
|00001aa0| 69 74 20 6d 65 6e 75 20 | 69 74 65 6d 73 20 28 77 |it menu |items (w|
|00001ab0| 65 20 0d 77 6f 6e d5 74 | 20 73 75 70 70 6f 72 74 |e .won.t| support|
|00001ac0| 20 53 61 76 65 29 2e 20 | 53 65 65 20 74 68 65 20 | Save). |See the |
|00001ad0| 73 6f 75 72 63 65 20 63 | 6f 64 65 20 66 6f 72 20 |source c|ode for |
|00001ae0| 74 68 65 20 0d 64 65 66 | 69 6e 69 74 69 6f 6e 73 |the .def|initions|
|00001af0| 20 6f 66 20 74 68 65 20 | 43 6c 6f 73 65 20 61 6e | of the |Close an|
|00001b00| 64 20 51 75 69 74 20 6d | 65 6e 75 20 69 74 65 6d |d Quit m|enu item|
|00001b10| 73 2e 0d 0d 54 79 70 65 | 20 61 6e 64 20 65 76 61 |s...Type| and eva|
|00001b20| 6c 75 61 74 65 20 74 68 | 69 73 20 65 78 70 72 65 |luate th|is expre|
|00001b30| 73 73 69 6f 6e 20 69 6e | 20 61 20 74 65 78 74 20 |ssion in| a text |
|00001b40| 77 69 6e 64 6f 77 3a 0d | 0d 28 64 65 66 76 61 72 |window:.|.(defvar|
|00001b50| 20 2a 6d 69 6e 69 2d 61 | 70 70 6c 69 63 61 74 69 | *mini-a|pplicati|
|00001b60| 6f 6e 2d 66 69 6c 65 2d | 6d 65 6e 75 2a 0d 20 20 |on-file-|menu*. |
|00001b70| 28 6d 61 6b 65 2d 69 6e | 73 74 61 6e 63 65 20 27 |(make-in|stance '|
|00001b80| 6d 65 6e 75 20 3a 6d 65 | 6e 75 2d 74 69 74 6c 65 |menu :me|nu-title|
|00001b90| 20 22 46 69 6c 65 22 29 | 29 0d 0d 46 69 72 73 74 | "File")|)..First|
|00001ba0| 2c 20 64 65 66 76 61 72 | 20 69 73 20 74 68 65 20 |, defvar| is the |
|00001bb0| 4c 69 73 70 20 66 75 6e | 63 74 69 6f 6e 20 74 68 |Lisp fun|ction th|
|00001bc0| 61 74 20 6c 65 74 73 20 | 79 6f 75 20 64 65 66 69 |at lets |you defi|
|00001bd0| 6e 65 20 0d 61 6e 64 20 | 69 6e 69 74 69 61 6c 69 |ne .and |initiali|
|00001be0| 7a 65 20 61 20 67 6c 6f | 62 61 6c 20 76 61 72 69 |ze a glo|bal vari|
|00001bf0| 61 62 6c 65 3a 20 20 77 | 65 20 68 61 76 65 20 74 |able: w|e have t|
|00001c00| 68 75 73 20 0d 69 6e 69 | 74 69 61 6c 69 7a 65 64 |hus .ini|tialized|
|00001c10| 20 74 68 65 20 76 61 72 | 69 61 62 6c 65 20 2a 6d | the var|iable *m|
|00001c20| 69 6e 69 2d 61 70 70 6c | 69 63 61 74 69 6f 6e 2d |ini-appl|ication-|
|00001c30| 66 69 6c 65 2d 6d 65 6e | 75 2a 20 0d 74 6f 20 63 |file-men|u* .to c|
|00001c40| 6f 6e 74 61 69 6e 20 74 | 68 65 20 6d 65 6e 75 20 |ontain t|he menu |
|00001c50| 69 6e 73 74 61 6e 63 65 | 2e 20 54 68 65 20 6d 65 |instance|. The me|
|00001c60| 74 68 6f 64 20 6d 61 6b | 65 2d 0d 69 6e 73 74 61 |thod mak|e-.insta|
|00001c70| 6e 63 65 2c 20 77 68 69 | 63 68 20 69 73 20 73 69 |nce, whi|ch is si|
|00001c80| 6d 69 6c 61 72 20 74 6f | 20 4e 65 77 20 69 6e 20 |milar to| New in |
|00001c90| 53 6d 61 6c 6c 54 61 6c | 6b 20 61 6e 64 20 69 6e |SmallTal|k and in|
|00001ca0| 20 0d 4d 61 63 41 70 70 | 2c 20 65 6e 61 62 6c 65 | .MacApp|, enable|
|00001cb0| 73 20 79 6f 75 20 74 6f | 20 63 72 65 61 74 65 20 |s you to| create |
|00001cc0| 61 6e 20 69 6e 73 74 61 | 6e 63 65 20 66 72 6f 6d |an insta|nce from|
|00001cd0| 20 61 20 0d 63 6c 61 73 | 73 2c 20 61 6e 64 20 74 | a .clas|s, and t|
|00001ce0| 6f 20 6f 70 74 69 6f 6e | 61 6c 6c 79 20 69 6e 69 |o option|ally ini|
|00001cf0| 74 69 61 6c 69 7a 65 20 | 73 6f 6d 65 20 6f 66 20 |tialize |some of |
|00001d00| 69 74 73 20 73 6c 6f 74 | 73 2e 20 0d 28 54 68 65 |its slot|s. .(The|
|00001d10| 20 74 65 72 6d 20 73 6c | 6f 74 20 69 73 20 73 79 | term sl|ot is sy|
|00001d20| 6e 6f 6e 79 6d 6f 75 73 | 20 77 69 74 68 20 69 6e |nonymous| with in|
|00001d30| 73 74 61 6e 63 65 20 76 | 61 72 69 61 62 6c 65 20 |stance v|ariable |
|00001d40| 69 6e 20 0d 6f 74 68 65 | 72 20 6f 62 6a 65 63 74 |in .othe|r object|
|00001d50| 2d 62 61 73 65 64 20 6c | 61 6e 67 75 61 67 65 73 |-based l|anguages|
|00001d60| 2e 29 20 54 68 65 20 66 | 69 72 73 74 20 61 72 67 |.) The f|irst arg|
|00001d70| 75 6d 65 6e 74 20 74 6f | 20 0d 6d 61 6b 65 2d 69 |ument to| .make-i|
|00001d80| 6e 73 74 61 6e 63 65 20 | 69 73 20 74 68 65 20 6e |nstance |is the n|
|00001d90| 61 6d 65 20 6f 66 20 74 | 68 65 20 63 6c 61 73 73 |ame of t|he class|
|00001da0| 2c 20 61 6e 64 20 74 68 | 65 20 0d 73 75 62 73 65 |, and th|e .subse|
|00001db0| 71 75 65 6e 74 20 61 72 | 67 75 6d 65 6e 74 73 20 |quent ar|guments |
|00001dc0| 61 72 65 20 6b 65 79 77 | 6f 72 64 2d 76 61 6c 75 |are keyw|ord-valu|
|00001dd0| 65 20 70 61 69 72 73 20 | 77 69 74 68 20 0d 6f 70 |e pairs |with .op|
|00001de0| 74 69 6f 6e 61 6c 20 69 | 6e 69 74 69 61 6c 69 7a |tional i|nitializ|
|00001df0| 61 74 69 6f 6e 73 20 74 | 68 61 74 20 64 65 70 65 |ations t|hat depe|
|00001e00| 6e 64 20 6f 6e 20 74 68 | 65 20 63 6c 61 73 73 2e |nd on th|e class.|
|00001e10| 20 0d 41 62 6f 76 65 2c | 20 74 68 65 20 70 72 65 | .Above,| the pre|
|00001e20| 64 65 66 69 6e 65 64 20 | 4d 43 4c 20 63 6c 61 73 |defined |MCL clas|
|00001e30| 73 20 6d 65 6e 75 20 69 | 73 20 69 6e 73 74 61 6e |s menu i|s instan|
|00001e40| 74 69 61 74 65 64 20 0d | 61 6e 64 20 74 68 65 20 |tiated .|and the |
|00001e50| 3a 6d 65 6e 75 2d 74 69 | 74 6c 65 20 6b 65 79 77 |:menu-ti|tle keyw|
|00001e60| 6f 72 64 20 6f 70 74 69 | 6f 6e 20 69 73 20 69 6e |ord opti|on is in|
|00001e70| 69 74 69 61 6c 69 7a 65 | 64 20 77 69 74 68 20 0d |itialize|d with .|
|00001e80| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 74 68 65 20 |the name| of the |
|00001e90| 6d 65 6e 75 2e 20 28 54 | 68 65 20 6e 61 6d 65 20 |menu. (T|he name |
|00001ea0| 6d 65 6e 75 20 69 73 20 | 70 72 65 63 65 64 65 64 |menu is |preceded|
|00001eb0| 20 0d 77 69 74 68 20 61 | 20 73 69 6e 67 6c 65 20 | .with a| single |
|00001ec0| 71 75 6f 74 61 74 69 6f | 6e 20 6d 61 72 6b 20 74 |quotatio|n mark t|
|00001ed0| 6f 20 69 6e 64 69 63 61 | 74 65 20 74 68 61 74 20 |o indica|te that |
|00001ee0| 77 65 20 61 72 65 20 0d | 72 65 66 65 72 72 69 6e |we are .|referrin|
|00001ef0| 67 20 74 6f 20 74 68 65 | 20 73 79 6d 62 6f 6c 20 |g to the| symbol |
|00001f00| 6d 65 6e 75 20 72 61 74 | 68 65 72 20 74 68 61 6e |menu rat|her than|
|00001f10| 20 74 6f 20 74 68 65 20 | 0d 76 61 72 69 61 62 6c | to the |.variabl|
|00001f20| 65 20 6d 65 6e 75 2e 29 | 20 20 0d 0d 54 6f 20 74 |e menu.)| ..To t|
|00001f30| 65 73 74 20 74 68 69 73 | 20 69 6e 73 74 61 6e 63 |est this| instanc|
|00001f40| 65 2c 20 79 6f 75 20 63 | 61 6e 20 69 6e 76 6f 6b |e, you c|an invok|
|00001f50| 65 20 74 68 65 20 6d 65 | 6e 75 2d 69 6e 73 74 61 |e the me|nu-insta|
|00001f60| 6c 6c 20 0d 6d 65 74 68 | 6f 64 20 6f 6e 20 69 74 |ll .meth|od on it|
|00001f70| 3a 0d 0d 28 6d 65 6e 75 | 2d 69 6e 73 74 61 6c 6c |:..(menu|-install|
|00001f80| 20 2a 6d 69 6e 69 2d 61 | 70 70 6c 69 63 61 74 69 | *mini-a|pplicati|
|00001f90| 6f 6e 2d 66 69 6c 65 2d | 6d 65 6e 75 2a 29 0d 0d |on-file-|menu*)..|
|00001fa0| 54 68 65 20 6d 65 6e 75 | 20 62 61 72 20 73 68 6f |The menu| bar sho|
|00001fb0| 75 6c 64 20 6e 6f 77 20 | 69 6e 63 6c 75 64 65 20 |uld now |include |
|00001fc0| 61 20 6e 65 77 20 46 69 | 6c 65 20 6d 65 6e 75 20 |a new Fi|le menu |
|00001fd0| 6f 6e 20 0d 74 68 65 20 | 66 61 72 20 72 69 67 68 |on .the |far righ|
|00001fe0| 74 2e 20 43 6c 69 63 6b | 69 6e 67 20 6f 6e 20 74 |t. Click|ing on t|
|00001ff0| 68 65 20 6e 65 77 20 46 | 69 6c 65 20 6d 65 6e 75 |he new F|ile menu|
|00002000| 20 77 69 6c 6c 20 6e 6f | 74 20 0d 79 69 65 6c 64 | will no|t .yield|
|00002010| 20 61 6e 79 20 6d 65 6e | 75 20 69 74 65 6d 73 2c | any men|u items,|
|00002020| 20 73 6f 20 6c 65 74 d5 | 73 20 64 65 66 69 6e 65 | so let.|s define|
|00002030| 20 6f 6e 65 2e 20 45 76 | 61 6c 75 61 74 65 20 74 | one. Ev|aluate t|
|00002040| 68 65 20 0d 66 6f 6c 6c | 6f 77 69 6e 67 3a 0d 0d |he .foll|owing:..|
|00002050| 28 64 65 66 76 61 72 20 | 2a 66 69 6c 65 2d 6e 65 |(defvar |*file-ne|
|00002060| 77 2d 6d 65 6e 75 2d 69 | 74 65 6d 2a 0d 20 20 28 |w-menu-i|tem*. (|
|00002070| 6d 61 6b 65 2d 69 6e 73 | 74 61 6e 63 65 20 27 6d |make-ins|tance 'm|
|00002080| 65 6e 75 2d 69 74 65 6d | 0d 20 20 20 20 3a 6d 65 |enu-item|. :me|
|00002090| 6e 75 2d 69 74 65 6d 2d | 74 69 74 6c 65 20 22 4e |nu-item-|title "N|
|000020a0| 65 77 22 0d 20 20 20 20 | 3a 63 6f 6d 6d 61 6e 64 |ew". |:command|
|000020b0| 2d 6b 65 79 20 23 5c 4e | 0d 20 20 20 20 3a 6d 65 |-key #\N|. :me|
|000020c0| 6e 75 2d 69 74 65 6d 2d | 61 63 74 69 6f 6e 20 27 |nu-item-|action '|
|000020d0| 6e 65 77 2d 6d 65 6e 75 | 2d 69 74 65 6d 2d 61 63 |new-menu|-item-ac|
|000020e0| 74 69 6f 6e 29 29 0d 0d | 54 68 65 20 70 72 65 64 |tion))..|The pred|
|000020f0| 65 66 69 6e 65 64 20 4d | 43 4c 20 63 6c 61 73 73 |efined M|CL class|
|00002100| 20 6d 65 6e 75 2d 69 74 | 65 6d 20 73 75 70 70 6f | menu-it|em suppo|
|00002110| 72 74 73 2c 20 0d 61 6d | 6f 6e 67 20 6f 74 68 65 |rts, .am|ong othe|
|00002120| 72 20 74 68 69 6e 67 73 | 2c 20 61 6e 20 6f 70 74 |r things|, an opt|
|00002130| 69 6f 6e 61 6c 20 63 6f | 6d 6d 61 6e 64 2d 6b 65 |ional co|mmand-ke|
|00002140| 79 20 0d 63 68 61 72 61 | 63 74 65 72 20 2d 20 63 |y .chara|cter - c|
|00002150| 68 61 72 61 63 74 65 72 | 73 20 69 6e 20 4c 69 73 |haracter|s in Lis|
|00002160| 70 20 61 72 65 20 72 65 | 70 72 65 73 65 6e 74 65 |p are re|presente|
|00002170| 64 20 62 79 20 0d 70 72 | 65 66 69 78 69 6e 67 20 |d by .pr|efixing |
|00002180| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 20 77 69 |the char|acter wi|
|00002190| 74 68 20 23 5c 20 2d 20 | 61 6e 64 20 61 20 6d 65 |th #\ - |and a me|
|000021a0| 6e 75 20 69 74 65 6d 20 | 0d 61 63 74 69 6f 6e 2e |nu item |.action.|
|000021b0| 20 54 68 65 20 6c 61 74 | 74 65 72 20 69 73 20 61 | The lat|ter is a|
|000021c0| 20 66 75 6e 63 74 69 6f | 6e 20 74 68 61 74 20 77 | functio|n that w|
|000021d0| 69 6c 6c 20 62 65 20 63 | 61 6c 6c 65 64 20 0d 77 |ill be c|alled .w|
|000021e0| 68 65 6e 20 74 68 65 20 | 6d 65 6e 75 20 69 74 65 |hen the |menu ite|
|000021f0| 6d 20 69 73 20 63 68 6f | 73 65 6e 2e 20 49 6e 20 |m is cho|sen. In |
|00002200| 74 68 69 73 20 65 78 61 | 6d 70 6c 65 2c 20 77 65 |this exa|mple, we|
|00002210| 20 0d 64 65 66 69 6e 65 | 20 74 68 65 20 6b 65 79 | .define| the key|
|00002220| 73 74 72 6f 6b 65 20 63 | 6f 6d 62 69 6e 61 74 69 |stroke c|ombinati|
|00002230| 6f 6e 20 43 6f 6d 6d 61 | 6e 64 2d 4e 20 74 6f 20 |on Comma|nd-N to |
|00002240| 62 65 20 0d 65 71 75 69 | 76 61 6c 65 6e 74 20 74 |be .equi|valent t|
|00002250| 6f 20 63 68 6f 6f 73 69 | 6e 67 20 74 68 65 20 6d |o choosi|ng the m|
|00002260| 65 6e 75 20 69 74 65 6d | 2e 20 57 65 20 68 61 76 |enu item|. We hav|
|00002270| 65 20 61 6c 73 6f 20 0d | 67 69 76 65 6e 20 6e 65 |e also .|given ne|
|00002280| 77 2d 6d 65 6e 75 2d 69 | 74 65 6d 2d 61 63 74 69 |w-menu-i|tem-acti|
|00002290| 6f 6e 20 61 73 20 74 68 | 65 20 6e 61 6d 65 20 6f |on as th|e name o|
|000022a0| 66 20 74 68 65 20 0d 66 | 75 6e 63 74 69 6f 6e 20 |f the .f|unction |
|000022b0| 74 68 61 74 20 73 68 6f | 75 6c 64 20 62 65 20 63 |that sho|uld be c|
|000022c0| 61 6c 6c 65 64 20 77 68 | 65 6e 20 74 68 69 73 20 |alled wh|en this |
|000022d0| 6d 65 6e 75 20 69 74 65 | 6d 20 69 73 20 0d 63 68 |menu ite|m is .ch|
|000022e0| 6f 73 65 6e 20 2d 20 6e | 65 77 2d 6d 65 6e 75 2d |osen - n|ew-menu-|
|000022f0| 69 74 65 6d 2d 61 63 74 | 69 6f 6e 20 69 73 20 64 |item-act|ion is d|
|00002300| 65 66 69 6e 65 64 20 69 | 6e 20 74 68 65 20 0d 73 |efined i|n the .s|
|00002310| 65 63 74 69 6f 6e 20 d2 | 43 72 65 61 74 69 6e 67 |ection .|Creating|
|00002320| 20 4f 75 72 20 57 69 6e | 64 6f 77 d3 2e 20 54 68 | Our Win|dow.. Th|
|00002330| 65 20 61 64 64 69 74 69 | 6f 6e 61 6c 20 0d 6b 65 |e additi|onal .ke|
|00002340| 79 77 6f 72 64 73 20 3a | 64 69 73 61 62 6c 65 64 |ywords :|disabled|
|00002350| 2c 20 3a 6d 65 6e 75 2d | 69 74 65 6d 2d 63 6f 6c |, :menu-|item-col|
|00002360| 6f 72 2c 20 3a 6d 65 6e | 75 2d 69 74 65 6d 2d 0d |or, :men|u-item-.|
|00002370| 63 68 65 63 6b 65 64 2c | 20 61 6e 64 20 3a 73 74 |checked,| and :st|
|00002380| 79 6c 65 20 70 65 72 6d | 69 74 20 79 6f 75 20 74 |yle perm|it you t|
|00002390| 6f 20 73 70 65 63 69 66 | 79 20 77 68 65 74 68 65 |o specif|y whethe|
|000023a0| 72 20 74 68 65 20 0d 6d | 65 6e 75 20 69 74 65 6d |r the .m|enu item|
|000023b0| 20 73 68 6f 75 6c 64 20 | 62 65 20 64 69 73 61 62 | should |be disab|
|000023c0| 6c 65 64 2c 20 74 68 65 | 20 63 6f 6c 6f 72 73 20 |led, the| colors |
|000023d0| 6f 66 20 74 68 65 20 70 | 61 72 74 73 20 0d 6f 66 |of the p|arts .of|
|000023e0| 20 74 68 65 20 6d 65 6e | 75 20 28 73 75 63 68 20 | the men|u (such |
|000023f0| 61 73 20 62 61 63 6b 67 | 72 6f 75 6e 64 2c 20 74 |as backg|round, t|
|00002400| 65 78 74 29 2c 20 77 68 | 65 74 68 65 72 20 74 68 |ext), wh|ether th|
|00002410| 65 20 0d 69 74 65 6d 20 | 73 68 6f 75 6c 64 20 62 |e .item |should b|
|00002420| 65 20 63 68 65 63 6b 65 | 64 2c 20 61 6e 64 20 69 |e checke|d, and i|
|00002430| 74 73 20 73 74 79 6c 65 | 2e 0d 0d 57 65 20 61 72 |ts style|...We ar|
|00002440| 65 20 72 65 61 64 79 20 | 74 6f 20 69 6e 73 74 61 |e ready |to insta|
|00002450| 6c 6c 20 74 68 65 20 6e | 65 77 20 6d 65 6e 75 20 |ll the n|ew menu |
|00002460| 69 74 65 6d 20 6f 6e 20 | 74 68 65 20 46 69 6c 65 |item on |the File|
|00002470| 20 0d 6d 65 6e 75 2e 20 | 54 79 70 65 20 61 6e 64 | .menu. |Type and|
|00002480| 20 65 76 61 6c 75 61 74 | 65 20 74 68 65 20 66 6f | evaluat|e the fo|
|00002490| 6c 6c 6f 77 69 6e 67 20 | 69 6e 20 61 20 74 65 78 |llowing |in a tex|
|000024a0| 74 20 0d 77 69 6e 64 6f | 77 3a 0d 0d 28 61 64 64 |t .windo|w:..(add|
|000024b0| 2d 6d 65 6e 75 2d 69 74 | 65 6d 73 20 2a 6d 69 6e |-menu-it|ems *min|
|000024c0| 69 2d 61 70 70 6c 69 63 | 61 74 69 6f 6e 2d 66 69 |i-applic|ation-fi|
|000024d0| 6c 65 2d 6d 65 6e 75 2a | 0d 20 20 20 20 20 20 20 |le-menu*|. |
|000024e0| 20 20 20 20 20 20 20 20 | 20 2a 66 69 6c 65 2d 6e | | *file-n|
|000024f0| 65 77 2d 6d 65 6e 75 2d | 69 74 65 6d 2a 29 0d 0d |ew-menu-|item*)..|
|00002500| 61 64 64 2d 6d 65 6e 75 | 2d 69 74 65 6d 73 20 69 |add-menu|-items i|
|00002510| 73 20 61 20 70 72 65 64 | 65 66 69 6e 65 64 20 4d |s a pred|efined M|
|00002520| 43 4c 20 6d 65 74 68 6f | 64 20 66 6f 72 20 0d 6d |CL metho|d for .m|
|00002530| 65 6e 75 73 20 74 68 61 | 74 20 65 6e 61 62 6c 65 |enus tha|t enable|
|00002540| 73 20 75 73 20 74 6f 20 | 61 64 64 20 6f 6e 65 20 |s us to |add one |
|00002550| 6f 72 20 6d 6f 72 65 20 | 6d 65 6e 75 20 69 74 65 |or more |menu ite|
|00002560| 6d 73 20 0d 74 6f 20 61 | 20 6d 65 6e 75 d1 77 68 |ms .to a| menu.wh|
|00002570| 65 74 68 65 72 20 74 68 | 65 20 6d 65 6e 75 20 69 |ether th|e menu i|
|00002580| 73 20 69 6e 73 74 61 6c | 6c 65 64 20 6f 72 20 6e |s instal|led or n|
|00002590| 6f 74 2e 20 49 66 20 79 | 6f 75 20 0d 70 75 6c 6c |ot. If y|ou .pull|
|000025a0| 20 64 6f 77 6e 20 74 68 | 65 20 6e 65 77 20 46 69 | down th|e new Fi|
|000025b0| 6c 65 20 6d 65 6e 75 2c | 20 79 6f 75 20 73 68 6f |le menu,| you sho|
|000025c0| 75 6c 64 20 73 65 65 20 | 74 68 65 20 4e 65 77 20 |uld see |the New |
|000025d0| 0d 69 74 65 6d 2e 20 48 | 6f 77 65 76 65 72 2c 20 |.item. H|owever, |
|000025e0| 69 66 20 79 6f 75 20 63 | 68 6f 6f 73 65 20 74 68 |if you c|hoose th|
|000025f0| 69 73 20 69 74 65 6d 2c | 20 79 6f 75 20 73 68 6f |is item,| you sho|
|00002600| 75 6c 64 20 73 65 65 20 | 0d 61 6e 20 65 72 72 6f |uld see |.an erro|
|00002610| 72 20 72 65 70 6f 72 74 | 20 69 6e 20 74 68 65 20 |r report| in the |
|00002620| 4c 69 73 74 65 6e 65 72 | 20 74 65 6c 6c 69 6e 67 |Listener| telling|
|00002630| 20 79 6f 75 20 74 68 61 | 74 20 6e 65 77 2d 0d 6d | you tha|t new-.m|
|00002640| 65 6e 75 2d 69 74 65 6d | 2d 61 63 74 69 6f 6e 20 |enu-item|-action |
|00002650| 69 73 20 75 6e 64 65 66 | 69 6e 65 64 2e 20 4c 69 |is undef|ined. Li|
|00002660| 73 70 20 69 73 20 66 6f | 72 67 69 76 69 6e 67 20 |sp is fo|rgiving |
|00002670| 62 75 74 20 0d 6e 6f 74 | 20 63 6c 61 69 72 76 6f |but .not| clairvo|
|00002680| 79 61 6e 74 21 0d 0d 4e | 6f 77 20 74 68 61 74 20 |yant!..N|ow that |
|00002690| 77 65 20 6b 6e 6f 77 20 | 68 6f 77 20 74 6f 20 64 |we know |how to d|
|000026a0| 65 66 69 6e 65 20 6d 65 | 6e 75 73 20 61 6e 64 20 |efine me|nus and |
|000026b0| 6d 65 6e 75 20 0d 69 74 | 65 6d 73 2c 20 77 65 20 |menu .it|ems, we |
|000026c0| 77 61 6e 74 20 74 6f 20 | 64 65 66 69 6e 65 20 61 |want to |define a|
|000026d0| 20 6d 65 6e 75 20 62 61 | 72 20 73 6f 20 74 68 61 | menu ba|r so tha|
|000026e0| 74 20 77 65 20 63 61 6e | 20 0d 74 72 65 61 74 20 |t we can| .treat |
|000026f0| 6f 75 72 20 61 70 70 6c | 69 63 61 74 69 6f 6e d5 |our appl|ication.|
|00002700| 73 20 6d 65 6e 75 73 20 | 61 73 20 61 20 75 6e 69 |s menus |as a uni|
|00002710| 74 2e 20 46 69 72 73 74 | 2c 20 6c 65 74 d5 73 20 |t. First|, let.s |
|00002720| 0d 64 65 69 6e 73 74 61 | 6c 6c 20 6f 75 72 20 46 |.deinsta|ll our F|
|00002730| 69 6c 65 20 6d 65 6e 75 | 20 62 79 20 65 76 61 6c |ile menu| by eval|
|00002740| 75 61 74 69 6e 67 20 74 | 68 65 20 66 6f 6c 6c 6f |uating t|he follo|
|00002750| 77 69 6e 67 3a 0d 0d 28 | 6d 65 6e 75 2d 64 65 69 |wing:..(|menu-dei|
|00002760| 6e 73 74 61 6c 6c 20 2a | 6d 69 6e 69 2d 61 70 70 |nstall *|mini-app|
|00002770| 6c 69 63 61 74 69 6f 6e | 2d 66 69 6c 65 2d 6d 65 |lication|-file-me|
|00002780| 6e 75 2a 29 0d 0d 41 20 | 6d 65 6e 75 20 62 61 72 |nu*)..A |menu bar|
|00002790| 20 63 6f 6e 73 69 73 74 | 73 20 6f 66 20 61 20 6c | consist|s of a l|
|000027a0| 69 73 74 20 6f 66 20 6d | 65 6e 75 73 20 74 68 61 |ist of m|enus tha|
|000027b0| 74 20 77 69 6c 6c 20 62 | 65 20 0d 64 69 73 70 6c |t will b|e .displ|
|000027c0| 61 79 65 64 20 69 6e 20 | 61 20 6c 65 66 74 2d 74 |ayed in |a left-t|
|000027d0| 6f 2d 72 69 67 68 74 20 | 6f 72 64 65 72 2e 20 54 |o-right |order. T|
|000027e0| 68 65 20 63 6f 6d 70 6c | 65 74 65 20 73 6f 75 72 |he compl|ete sour|
|000027f0| 63 65 20 0d 63 6f 64 65 | 20 66 6f 72 20 74 68 69 |ce .code| for thi|
|00002800| 73 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 64 65 |s applic|ation de|
|00002810| 66 69 6e 65 73 20 61 6c | 6c 20 6d 65 6e 75 73 20 |fines al|l menus |
|00002820| 61 6e 64 20 6d 65 6e 75 | 20 0d 69 74 65 6d 73 2c |and menu| .items,|
|00002830| 20 62 75 74 20 68 65 72 | 65 20 77 65 20 77 69 6c | but her|e we wil|
|00002840| 6c 20 72 65 73 74 72 69 | 63 74 20 6f 75 72 73 65 |l restri|ct ourse|
|00002850| 6c 76 65 73 20 74 6f 20 | 74 68 65 20 46 69 6c 65 |lves to |the File|
|00002860| 20 0d 61 6e 64 20 57 69 | 6e 64 6f 77 73 20 6d 65 | .and Wi|ndows me|
|00002870| 6e 75 73 2e 20 57 65 20 | 64 65 66 69 6e 65 20 74 |nus. We |define t|
|00002880| 68 65 20 6d 65 6e 75 20 | 62 61 72 20 62 79 20 0d |he menu |bar by .|
|00002890| 65 76 61 6c 75 61 74 69 | 6e 67 20 74 68 69 73 20 |evaluati|ng this |
|000028a0| 65 78 70 72 65 73 73 69 | 6f 6e 3a 0d 0d 28 64 65 |expressi|on:..(de|
|000028b0| 66 76 61 72 20 2a 6d 69 | 6e 69 2d 61 70 70 6c 69 |fvar *mi|ni-appli|
|000028c0| 63 61 74 69 6f 6e 2d 6d | 65 6e 75 62 61 72 2a 0d |cation-m|enubar*.|
|000028d0| 20 20 28 6c 69 73 74 20 | 2a 6d 69 6e 69 2d 61 70 | (list |*mini-ap|
|000028e0| 70 6c 69 63 61 74 69 6f | 6e 2d 66 69 6c 65 2d 6d |plicatio|n-file-m|
|000028f0| 65 6e 75 2a 0d 20 20 20 | 20 20 20 20 20 2a 77 69 |enu*. | *wi|
|00002900| 6e 64 6f 77 73 2d 6d 65 | 6e 75 2a 29 29 29 0d 0d |ndows-me|nu*)))..|
|00002910| 54 68 65 20 63 6f 6e 76 | 65 6e 69 65 6e 74 20 76 |The conv|enient v|
|00002920| 61 72 69 61 62 6c 65 20 | 2a 77 69 6e 64 6f 77 73 |ariable |*windows|
|00002930| 2d 6d 65 6e 75 2a 20 69 | 73 20 62 6f 75 6e 64 20 |-menu* i|s bound |
|00002940| 62 79 20 0d 4d 43 4c 20 | 74 6f 20 74 68 65 20 6d |by .MCL |to the m|
|00002950| 65 6e 75 20 74 68 61 74 | 20 4d 43 4c 20 61 6c 72 |enu that| MCL alr|
|00002960| 65 61 64 79 20 75 73 65 | 73 20 69 6e 20 69 74 73 |eady use|s in its|
|00002970| 20 6d 65 6e 75 20 0d 62 | 61 72 2c 20 73 6f 20 77 | menu .b|ar, so w|
|00002980| 65 20 61 64 64 20 69 74 | 20 68 65 72 65 20 74 6f |e add it| here to|
|00002990| 20 67 65 74 20 74 68 61 | 74 20 66 75 6e 63 74 69 | get tha|t functi|
|000029a0| 6f 6e 61 6c 69 74 79 20 | 66 6f 72 20 0d 66 72 65 |onality |for .fre|
|000029b0| 65 2e 20 54 6f 20 69 6e | 73 74 61 6c 6c 20 6f 75 |e. To in|stall ou|
|000029c0| 72 20 6d 65 6e 75 20 62 | 61 72 2c 20 65 76 61 6c |r menu b|ar, eval|
|000029d0| 75 61 74 65 20 74 68 69 | 73 3a 0d 0d 28 73 65 74 |uate thi|s:..(set|
|000029e0| 2d 6d 65 6e 75 62 61 72 | 20 2a 6d 69 6e 69 2d 61 |-menubar| *mini-a|
|000029f0| 70 70 6c 69 63 61 74 69 | 6f 6e 2d 6d 65 6e 75 62 |pplicati|on-menub|
|00002a00| 61 72 2a 29 0d 0d 73 65 | 74 2d 6d 65 6e 75 62 61 |ar*)..se|t-menuba|
|00002a10| 72 20 64 65 69 6e 73 74 | 61 6c 6c 73 20 74 68 65 |r deinst|alls the|
|00002a20| 20 4d 43 4c 20 6d 65 6e | 75 62 61 72 20 61 6e 64 | MCL men|ubar and|
|00002a30| 20 0d 69 6e 73 74 61 6c | 6c 73 20 6f 75 72 73 20 | .instal|ls ours |
|00002a40| 69 6e 20 69 74 73 20 70 | 6c 61 63 65 2e 20 4d 43 |in its p|lace. MC|
|00002a50| 4c 20 70 72 6f 76 69 64 | 65 73 20 61 20 73 65 74 |L provid|es a set|
|00002a60| 20 6f 66 20 0d 6d 65 74 | 68 6f 64 73 20 74 68 61 | of .met|hods tha|
|00002a70| 74 20 63 61 6e 20 62 65 | 20 69 6e 76 6f 6b 65 64 |t can be| invoked|
|00002a80| 20 61 74 20 61 6e 79 20 | 74 69 6d 65 20 6f 6e 20 | at any |time on |
|00002a90| 6d 65 6e 75 73 20 6f 72 | 20 0d 6d 65 6e 75 20 69 |menus or| .menu i|
|00002aa0| 74 65 6d 73 2e 20 46 6f | 72 20 65 78 61 6d 70 6c |tems. Fo|r exampl|
|00002ab0| 65 2c 20 65 78 61 6d 69 | 6e 65 20 74 68 65 20 4e |e, exami|ne the N|
|00002ac0| 65 77 20 69 74 65 6d 20 | 61 66 74 65 72 20 0d 65 |ew item |after .e|
|00002ad0| 76 61 6c 75 61 74 69 6e | 67 20 65 61 63 68 20 6f |valuatin|g each o|
|00002ae0| 66 20 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |f the f|ollowing|
|00002af0| 20 6c 69 6e 65 73 3a 0d | 0d 28 73 65 74 2d 6d 65 | lines:.|.(set-me|
|00002b00| 6e 75 2d 69 74 65 6d 2d | 63 68 65 63 6b 2d 6d 61 |nu-item-|check-ma|
|00002b10| 72 6b 20 2a 66 69 6c 65 | 2d 6e 65 77 2d 6d 65 6e |rk *file|-new-men|
|00002b20| 75 2d 69 74 65 6d 2a 20 | 74 29 20 3b 20 50 75 74 |u-item* |t) ; Put|
|00002b30| 20 61 20 63 68 65 63 6b | 20 6d 61 72 6b 0d 0d 28 | a check| mark..(|
|00002b40| 73 65 74 2d 6d 65 6e 75 | 2d 69 74 65 6d 2d 73 74 |set-menu|-item-st|
|00002b50| 79 6c 65 20 2a 66 69 6c | 65 2d 6e 65 77 2d 6d 65 |yle *fil|e-new-me|
|00002b60| 6e 75 2d 69 74 65 6d 2a | 20 3a 6f 75 74 6c 69 6e |nu-item*| :outlin|
|00002b70| 65 29 20 3b 20 4f 75 74 | 6c 69 6e 65 20 66 6f 6e |e) ; Out|line fon|
|00002b80| 74 0d 0d 28 73 65 74 2d | 6d 65 6e 75 2d 69 74 65 |t..(set-|menu-ite|
|00002b90| 6d 2d 74 69 74 6c 65 20 | 2a 66 69 6c 65 2d 6e 65 |m-title |*file-ne|
|00002ba0| 77 2d 6d 65 6e 75 2d 69 | 74 65 6d 2a 20 22 57 61 |w-menu-i|tem* "Wa|
|00002bb0| 73 20 4e 65 77 22 29 20 | 3b 20 4f 74 68 65 72 20 |s New") |; Other |
|00002bc0| 74 69 74 6c 65 0d 0d 28 | 6d 65 6e 75 2d 69 74 65 |title..(|menu-ite|
|00002bd0| 6d 2d 64 69 73 61 62 6c | 65 20 2a 66 69 6c 65 2d |m-disabl|e *file-|
|00002be0| 6e 65 77 2d 6d 65 6e 75 | 2d 69 74 65 6d 2a 29 20 |new-menu|-item*) |
|00002bf0| 20 3b 20 44 69 73 61 62 | 6c 65 20 74 68 65 20 6d | ; Disab|le the m|
|00002c00| 65 6e 75 20 69 74 65 6d | 0d 0d 4d 43 4c 20 62 69 |enu item|..MCL bi|
|00002c10| 6e 64 73 20 69 74 73 20 | 6f 77 6e 20 6d 65 6e 75 |nds its |own menu|
|00002c20| 20 62 61 72 20 74 6f 20 | 74 68 65 20 67 6c 6f 62 | bar to |the glob|
|00002c30| 61 6c 20 2a 64 65 66 61 | 75 6c 74 2d 0d 6d 65 6e |al *defa|ult-.men|
|00002c40| 75 62 61 72 2a 20 28 6e | 65 76 65 72 20 6c 65 61 |ubar* (n|ever lea|
|00002c50| 76 65 20 68 6f 6d 65 20 | 77 69 74 68 6f 75 74 20 |ve home |without |
|00002c60| 69 74 21 29 2c 20 73 6f | 20 74 6f 20 67 65 74 20 |it!), so| to get |
|00002c70| 0d 62 61 63 6b 20 74 6f | 20 4d 43 4c d5 73 20 6d |.back to| MCL.s m|
|00002c80| 65 6e 75 20 62 61 72 2c | 20 65 76 61 6c 75 61 74 |enu bar,| evaluat|
|00002c90| 65 3a 0d 0d 28 73 65 74 | 2d 6d 65 6e 75 62 61 72 |e:..(set|-menubar|
|00002ca0| 20 2a 64 65 66 61 75 6c | 74 2d 6d 65 6e 75 62 61 | *defaul|t-menuba|
|00002cb0| 72 2a 29 0d 0d 46 69 6e | 61 6c 6c 79 2c 20 77 65 |r*)..Fin|ally, we|
|00002cc0| 20 77 61 6e 74 20 74 6f | 20 64 65 66 69 6e 65 20 | want to| define |
|00002cd0| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 73 68 6f |the func|tion sho|
|00002ce0| 77 2d 6d 65 6e 75 73 2c | 20 0d 77 68 69 63 68 20 |w-menus,| .which |
|00002cf0| 77 69 6c 6c 20 62 65 20 | 63 61 6c 6c 65 64 20 62 |will be |called b|
|00002d00| 79 20 73 74 61 72 74 2d | 61 70 70 6c 69 63 61 74 |y start-|applicat|
|00002d10| 69 6f 6e 20 77 68 65 6e | 20 6f 75 72 20 0d 61 70 |ion when| our .ap|
|00002d20| 70 6c 69 63 61 74 69 6f | 6e 20 6e 65 65 64 73 20 |plicatio|n needs |
|00002d30| 74 6f 20 62 65 20 73 74 | 61 72 74 65 64 2e 20 54 |to be st|arted. T|
|00002d40| 68 69 73 20 69 73 20 73 | 69 6d 70 6c 65 3a 0d 0d |his is s|imple:..|
|00002d50| 28 64 65 66 75 6e 20 73 | 68 6f 77 2d 6d 65 6e 75 |(defun s|how-menu|
|00002d60| 73 20 28 29 0d 20 20 28 | 73 65 74 2d 6d 65 6e 75 |s (). (|set-menu|
|00002d70| 62 61 72 20 2a 6d 69 6e | 69 2d 61 70 70 6c 69 63 |bar *min|i-applic|
|00002d80| 61 74 69 6f 6e 2d 6d 65 | 6e 75 62 61 72 2a 29 29 |ation-me|nubar*))|
|00002d90| 0d 0d 54 68 65 20 63 6f | 6d 70 6c 65 74 65 20 73 |..The co|mplete s|
|00002da0| 6f 75 72 63 65 20 63 6f | 64 65 20 64 65 66 69 6e |ource co|de defin|
|00002db0| 65 73 20 2a 6d 69 6e 69 | 2d 61 70 70 6c 69 63 61 |es *mini|-applica|
|00002dc0| 74 69 6f 6e 2d 0d 6d 65 | 6e 75 62 61 72 2a 20 74 |tion-.me|nubar* t|
|00002dd0| 6f 20 69 6e 63 6c 75 64 | 65 20 61 6c 6c 20 6f 66 |o includ|e all of|
|00002de0| 20 74 68 65 20 6e 65 63 | 65 73 73 61 72 79 20 6d | the nec|essary m|
|00002df0| 65 6e 75 73 20 61 6e 64 | 20 0d 6d 65 6e 75 20 69 |enus and| .menu i|
|00002e00| 74 65 6d 73 20 74 6f 20 | 72 75 6e 20 74 68 65 20 |tems to |run the |
|00002e10| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 0d 0d 43 72 |applicat|ion...Cr|
|00002e20| 65 61 74 69 6e 67 20 4f | 75 72 20 57 69 6e 64 6f |eating O|ur Windo|
|00002e30| 77 0d 0d 54 6f 20 73 65 | 65 20 68 6f 77 20 77 69 |w..To se|e how wi|
|00002e40| 6e 64 6f 77 73 20 61 72 | 65 20 68 61 6e 64 6c 65 |ndows ar|e handle|
|00002e50| 64 2c 20 6c 65 74 d5 73 | 20 73 74 61 72 74 20 72 |d, let.s| start r|
|00002e60| 69 67 68 74 20 6f 66 66 | 20 0d 62 79 20 63 72 65 |ight off| .by cre|
|00002e70| 61 74 69 6e 67 20 6f 6e | 65 2e 20 45 76 61 6c 75 |ating on|e. Evalu|
|00002e80| 61 74 65 3a 0d 0d 28 73 | 65 74 71 20 6d 79 2d 77 |ate:..(s|etq my-w|
|00002e90| 69 6e 64 6f 77 20 28 6d | 61 6b 65 2d 69 6e 73 74 |indow (m|ake-inst|
|00002ea0| 61 6e 63 65 20 27 77 69 | 6e 64 6f 77 29 29 0d 0d |ance 'wi|ndow))..|
|00002eb0| 59 6f 75 20 73 68 6f 75 | 6c 64 20 69 6d 6d 65 64 |You shou|ld immed|
|00002ec0| 69 61 74 65 6c 79 20 73 | 65 65 20 61 20 77 69 6e |iately s|ee a win|
|00002ed0| 64 6f 77 20 6e 61 6d 65 | 64 20 55 6e 74 69 74 6c |dow name|d Untitl|
|00002ee0| 65 64 20 0d 61 70 70 65 | 61 72 20 6f 6e 20 79 6f |ed .appe|ar on yo|
|00002ef0| 75 72 20 6d 61 69 6e 20 | 73 63 72 65 65 6e 20 2e |ur main |screen .|
|00002f00| 20 4c 65 74 d5 73 20 73 | 65 65 20 77 68 61 74 20 | Let.s s|ee what |
|00002f10| 77 65 20 63 61 6e 20 64 | 6f 20 0d 77 69 74 68 20 |we can d|o .with |
|00002f20| 77 69 6e 64 6f 77 73 2e | 20 45 78 61 6d 69 6e 65 |windows.| Examine|
|00002f30| 20 74 68 65 20 77 69 6e | 64 6f 77 20 61 66 74 65 | the win|dow afte|
|00002f40| 72 20 65 76 61 6c 75 61 | 74 69 6e 67 20 0d 65 61 |r evalua|ting .ea|
|00002f50| 63 68 20 6f 66 20 74 68 | 65 20 66 6f 6c 6c 6f 77 |ch of th|e follow|
|00002f60| 69 6e 67 20 6c 69 6e 65 | 73 3a 0d 0d 28 73 65 74 |ing line|s:..(set|
|00002f70| 2d 77 69 6e 64 6f 77 2d | 74 69 74 6c 65 20 6d 79 |-window-|title my|
|00002f80| 2d 77 69 6e 64 6f 77 20 | 22 64 20 65 20 76 20 65 |-window |"d e v e|
|00002f90| 20 6c 20 6f 20 70 22 29 | 20 3b 20 43 68 61 6e 67 | l o p")| ; Chang|
|00002fa0| 65 20 77 69 6e 64 6f 77 | 20 74 69 74 6c 65 0d 0d |e window| title..|
|00002fb0| 28 73 65 74 2d 76 69 65 | 77 2d 73 69 7a 65 20 6d |(set-vie|w-size m|
|00002fc0| 79 2d 77 69 6e 64 6f 77 | 20 32 30 30 20 32 30 30 |y-window| 200 200|
|00002fd0| 29 20 3b 20 43 68 61 6e | 67 65 20 77 69 6e 64 6f |) ; Chan|ge windo|
|00002fe0| 77 20 73 69 7a 65 0d 0d | 28 73 65 74 2d 76 69 65 |w size..|(set-vie|
|00002ff0| 77 2d 70 6f 73 69 74 69 | 6f 6e 20 6d 79 2d 77 69 |w-positi|on my-wi|
|00003000| 6e 64 6f 77 20 31 35 30 | 20 35 30 29 20 3b 20 43 |ndow 150| 50) ; C|
|00003010| 68 61 6e 67 65 20 77 69 | 6e 64 6f 77 20 70 6f 73 |hange wi|ndow pos|
|00003020| 69 74 69 6f 6e 0d 0d 73 | 65 74 2d 77 69 6e 64 6f |ition..s|et-windo|
|00003030| 77 2d 74 69 74 6c 65 2c | 20 73 65 74 2d 76 69 65 |w-title,| set-vie|
|00003040| 77 2d 73 69 7a 65 2c 20 | 61 6e 64 20 6f 74 68 65 |w-size, |and othe|
|00003050| 72 20 66 75 6e 63 74 69 | 6f 6e 73 20 0d 75 73 65 |r functi|ons .use|
|00003060| 64 20 68 65 72 65 20 61 | 6e 64 20 69 6e 20 6f 74 |d here a|nd in ot|
|00003070| 68 65 72 20 70 6c 61 63 | 65 73 20 61 72 65 20 61 |her plac|es are a|
|00003080| 63 74 75 61 6c 6c 79 20 | 6d 65 74 68 6f 64 73 3a |ctually |methods:|
|00003090| 20 20 0d 74 68 65 79 20 | 61 72 65 20 73 65 6e 73 | .they |are sens|
|000030a0| 69 74 69 76 65 20 74 6f | 20 74 68 65 20 74 79 70 |itive to| the typ|
|000030b0| 65 73 20 6f 66 20 6f 62 | 6a 65 63 74 73 20 62 65 |es of ob|jects be|
|000030c0| 69 6e 67 20 70 61 73 73 | 65 64 20 0d 74 6f 20 74 |ing pass|ed .to t|
|000030d0| 68 65 6d 20 61 73 20 61 | 72 67 75 6d 65 6e 74 73 |hem as a|rguments|
|000030e0| 2e 20 41 73 20 77 69 74 | 68 20 6f 74 68 65 72 20 |. As wit|h other |
|000030f0| 6f 62 6a 65 63 74 2d 62 | 61 73 65 64 20 0d 6c 61 |object-b|ased .la|
|00003100| 6e 67 75 61 67 65 73 2c | 20 4c 69 73 70 20 6d 65 |nguages,| Lisp me|
|00003110| 74 68 6f 64 73 20 64 65 | 63 69 64 65 20 77 68 61 |thods de|cide wha|
|00003120| 74 20 74 6f 20 64 6f 20 | 62 61 73 65 64 20 6f 6e |t to do |based on|
|00003130| 20 74 68 65 20 0d 63 6c | 61 73 73 20 6f 66 20 77 | the .cl|ass of w|
|00003140| 68 69 63 68 20 74 68 65 | 20 6f 62 6a 65 63 74 20 |hich the| object |
|00003150| 69 73 20 61 6e 20 69 6e | 73 74 61 6e 63 65 2e 20 |is an in|stance. |
|00003160| 55 6e 6c 69 6b 65 20 6f | 74 68 65 72 20 0d 6f 62 |Unlike o|ther .ob|
|00003170| 6a 65 63 74 2d 62 61 73 | 65 64 20 73 79 73 74 65 |ject-bas|ed syste|
|00003180| 6d 73 20 74 68 61 74 20 | 6f 6e 6c 79 20 6c 6f 6f |ms that |only loo|
|00003190| 6b 20 61 74 20 74 68 65 | 20 63 6c 61 73 73 20 6f |k at the| class o|
|000031a0| 66 20 0d 74 68 65 20 66 | 69 72 73 74 20 61 72 67 |f .the f|irst arg|
|000031b0| 75 6d 65 6e 74 2c 20 74 | 68 65 20 43 6f 6d 6d 6f |ument, t|he Commo|
|000031c0| 6e 20 4c 69 73 70 20 4f | 62 6a 65 63 74 20 53 79 |n Lisp O|bject Sy|
|000031d0| 73 74 65 6d 20 0d 28 43 | 4c 4f 53 29 20 63 6f 6e |stem .(C|LOS) con|
|000031e0| 73 69 64 65 72 73 20 74 | 68 65 20 63 6c 61 73 73 |siders t|he class|
|000031f0| 65 73 20 6f 66 20 61 6c | 6c 20 6f 66 20 69 74 73 |es of al|l of its|
|00003200| 20 61 72 67 75 6d 65 6e | 74 73 20 0d 62 65 66 6f | argumen|ts .befo|
|00003210| 72 65 20 64 65 63 69 64 | 69 6e 67 20 77 68 61 74 |re decid|ing what|
|00003220| 20 74 6f 20 64 6f 2e 20 | 49 74 20 69 73 20 61 72 | to do. |It is ar|
|00003230| 67 75 61 62 6c 65 20 6a | 75 73 74 20 68 6f 77 20 |guable j|ust how |
|00003240| 0d 75 73 65 66 75 6c 20 | 74 68 69 73 20 72 65 61 |.useful |this rea|
|00003250| 6c 6c 79 20 69 73 2c 20 | 62 75 74 20 69 66 20 79 |lly is, |but if y|
|00003260| 6f 75 20 65 76 65 72 20 | 6e 65 65 64 20 74 68 69 |ou ever |need thi|
|00003270| 73 20 0d 63 61 70 61 62 | 69 6c 69 74 79 2c 20 69 |s .capab|ility, i|
|00003280| 74 d5 73 20 74 68 65 72 | 65 21 20 43 4c 4f 53 20 |t.s ther|e! CLOS |
|00003290| 69 73 20 69 6d 70 6c 65 | 6d 65 6e 74 65 64 20 73 |is imple|mented s|
|000032a0| 75 63 68 20 74 68 61 74 | 20 0d 79 6f 75 20 77 6f |uch that| .you wo|
|000032b0| 6e d5 74 20 70 61 79 20 | 66 6f 72 20 74 68 69 73 |n.t pay |for this|
|000032c0| 20 66 65 61 74 75 72 65 | 20 75 6e 6c 65 73 73 20 | feature| unless |
|000032d0| 79 6f 75 20 75 73 65 20 | 69 74 2e 20 0d 4d 65 74 |you use |it. .Met|
|000032e0| 68 6f 64 73 20 61 72 65 | 20 64 65 66 69 6e 65 64 |hods are| defined|
|000032f0| 20 75 73 69 6e 67 20 74 | 68 65 20 66 75 6e 63 74 | using t|he funct|
|00003300| 69 6f 6e 20 64 65 66 6d | 65 74 68 6f 64 2c 20 0d |ion defm|ethod, .|
|00003310| 77 68 69 6c 65 20 72 65 | 67 75 6c 61 72 20 66 75 |while re|gular fu|
|00003320| 6e 63 74 69 6f 6e 73 20 | 61 72 65 20 64 65 66 69 |nctions |are defi|
|00003330| 6e 65 64 20 75 73 69 6e | 67 20 64 65 66 75 6e 2e |ned usin|g defun.|
|00003340| 0d 0d 49 6e 20 6f 75 72 | 20 73 65 63 74 69 6f 6e |..In our| section|
|00003350| 20 6f 6e 20 6d 65 6e 75 | 73 20 61 6e 64 20 69 6e | on menu|s and in|
|00003360| 20 74 68 69 73 20 73 65 | 63 74 69 6f 6e 2c 20 77 | this se|ction, w|
|00003370| 65 d5 76 65 20 73 65 65 | 6e 20 0d 74 68 61 74 20 |e.ve see|n .that |
|00003380| 4d 43 4c 20 75 73 65 73 | 20 74 68 65 20 43 4c 4f |MCL uses| the CLO|
|00003390| 53 20 73 79 73 74 65 6d | 20 74 6f 20 69 6d 70 6c |S system| to impl|
|000033a0| 65 6d 65 6e 74 20 69 74 | 73 20 75 73 65 72 20 0d |ement it|s user .|
|000033b0| 69 6e 74 65 72 66 61 63 | 65 20 77 69 74 68 20 61 |interfac|e with a|
|000033c0| 20 76 61 72 69 65 74 79 | 20 6f 66 20 6d 65 74 68 | variety| of meth|
|000033d0| 6f 64 73 20 d1 20 66 6f | 72 20 65 78 61 6d 70 6c |ods . fo|r exampl|
|000033e0| 65 2c 20 61 64 64 2d 0d | 6d 65 6e 75 2d 69 74 65 |e, add-.|menu-ite|
|000033f0| 6d 73 2c 20 73 65 74 2d | 76 69 65 77 2d 70 6f 73 |ms, set-|view-pos|
|00003400| 69 74 69 6f 6e 2e 20 46 | 6f 72 74 75 6e 61 74 65 |ition. F|ortunate|
|00003410| 6c 79 2c 20 74 68 65 73 | 65 20 0d 6d 65 74 68 6f |ly, thes|e .metho|
|00003420| 64 73 20 61 72 65 20 61 | 6c 73 6f 20 61 76 61 69 |ds are a|lso avai|
|00003430| 6c 61 62 6c 65 20 74 6f | 20 75 73 2c 20 74 68 65 |lable to| us, the|
|00003440| 20 75 73 65 72 73 2e 20 | 4f 6e 65 20 6f 74 68 65 | users. |One othe|
|00003450| 72 20 0d 62 65 6e 65 66 | 69 74 20 6f 66 20 74 68 |r .benef|it of th|
|00003460| 65 20 4d 43 4c 20 75 73 | 65 72 20 69 6e 74 65 72 |e MCL us|er inter|
|00003470| 66 61 63 65 20 69 73 20 | 69 74 73 20 76 69 65 77 |face is |its view|
|00003480| 20 0d 61 72 63 68 69 74 | 65 63 74 75 72 65 20 61 | .archit|ecture a|
|00003490| 6e 64 2c 20 69 6e 20 61 | 64 64 69 74 69 6f 6e 20 |nd, in a|ddition |
|000034a0| 74 6f 20 77 69 6e 64 6f | 77 73 2c 20 61 20 75 73 |to windo|ws, a us|
|000034b0| 65 66 75 6c 20 0d 76 61 | 72 69 65 74 79 20 6f 66 |eful .va|riety of|
|000034c0| 20 70 72 65 64 65 66 69 | 6e 65 64 20 76 69 65 77 | predefi|ned view|
|000034d0| 73 20 6c 69 6b 65 20 72 | 61 64 69 6f 20 62 75 74 |s like r|adio but|
|000034e0| 74 6f 6e 73 2c 20 63 68 | 65 63 6b 20 0d 62 6f 78 |tons, ch|eck .box|
|000034f0| 65 73 2c 20 61 6e 64 20 | 65 64 69 74 61 62 6c 65 |es, and |editable|
|00003500| 20 74 65 78 74 2e 20 20 | 4c 65 74 d5 73 20 75 6e | text. |Let.s un|
|00003510| 64 65 72 73 74 61 6e 64 | 20 4d 43 4c d5 73 20 76 |derstand| MCL.s v|
|00003520| 69 65 77 20 0d 73 79 73 | 74 65 6d 20 73 6f 20 74 |iew .sys|tem so t|
|00003530| 68 61 74 20 77 65 20 63 | 61 6e 20 65 78 70 6c 6f |hat we c|an explo|
|00003540| 69 74 20 69 74 20 66 6f | 72 20 6f 75 72 20 61 70 |it it fo|r our ap|
|00003550| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 0d 54 68 65 20 |plicatio|n...The |
|00003560| 76 69 65 77 20 61 72 63 | 68 69 74 65 63 74 75 72 |view arc|hitectur|
|00003570| 65 20 61 6c 6c 6f 77 73 | 20 6f 6e 65 20 74 6f 20 |e allows| one to |
|00003580| 64 65 66 69 6e 65 20 67 | 72 61 70 68 69 63 20 0d |define g|raphic .|
|00003590| 6f 62 6a 65 63 74 73 20 | 61 73 20 76 69 65 77 73 |objects |as views|
|000035a0| 2e 20 41 20 76 69 65 77 | 20 68 61 73 20 69 74 73 |. A view| has its|
|000035b0| 20 6f 77 6e 20 63 6f 6f | 72 64 69 6e 61 74 65 20 | own coo|rdinate |
|000035c0| 0d 73 79 73 74 65 6d 20 | 61 6e 64 20 6f 72 69 67 |.system |and orig|
|000035d0| 69 6e 20 72 65 6c 61 74 | 69 76 65 20 74 6f 20 61 |in relat|ive to a|
|000035e0| 20 76 69 65 77 20 74 68 | 61 74 20 63 6f 6e 74 61 | view th|at conta|
|000035f0| 69 6e 73 20 69 74 20 0d | 28 63 61 6c 6c 65 64 20 |ins it .|(called |
|00003600| 74 68 65 20 76 69 65 77 | 20 63 6f 6e 74 61 69 6e |the view| contain|
|00003610| 65 72 29 3b 20 69 74 20 | 69 73 20 64 65 66 69 6e |er); it |is defin|
|00003620| 65 64 20 61 73 20 61 20 | 0d 72 65 63 74 61 6e 67 |ed as a |.rectang|
|00003630| 75 6c 61 72 20 61 72 65 | 61 20 64 65 74 65 72 6d |ular are|a determ|
|00003640| 69 6e 65 64 20 62 79 20 | 69 74 73 20 70 6f 73 69 |ined by |its posi|
|00003650| 74 69 6f 6e 20 72 65 6c | 61 74 69 76 65 20 74 6f |tion rel|ative to|
|00003660| 20 0d 69 74 73 20 63 6f | 6e 74 61 69 6e 65 72 20 | .its co|ntainer |
|00003670| 61 6e 64 20 69 74 73 20 | 73 69 7a 65 2e 20 49 74 |and its |size. It|
|00003680| 20 69 73 20 74 68 75 73 | 20 65 61 73 79 20 74 6f | is thus| easy to|
|00003690| 2c 20 66 6f 72 20 0d 65 | 78 61 6d 70 6c 65 2c 20 |, for .e|xample, |
|000036a0| 69 6e 64 65 70 65 6e 64 | 65 6e 74 6c 79 20 73 63 |independ|ently sc|
|000036b0| 72 6f 6c 6c 20 73 65 70 | 61 72 61 74 65 20 76 69 |roll sep|arate vi|
|000036c0| 65 77 73 2e 20 41 20 76 | 69 65 77 20 0d 63 61 6e |ews. A v|iew .can|
|000036d0| 20 62 65 20 61 20 77 69 | 6e 64 6f 77 2c 20 61 20 | be a wi|ndow, a |
|000036e0| 72 61 64 69 6f 20 62 75 | 74 74 6f 6e 2c 20 6f 72 |radio bu|tton, or|
|000036f0| 20 61 6e 79 74 68 69 6e | 67 20 74 68 61 74 20 63 | anythin|g that c|
|00003700| 61 6e 20 0d 62 65 20 64 | 69 73 70 6c 61 79 65 64 |an .be d|isplayed|
|00003710| 20 6f 6e 20 74 68 65 20 | 73 63 72 65 65 6e 2e 0d | on the |screen..|
|00003720| 0d 57 65 20 77 69 6c 6c | 20 62 75 69 6c 64 20 6f |.We will| build o|
|00003730| 75 72 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 77 |ur appli|cation w|
|00003740| 69 6e 64 6f 77 73 20 77 | 69 74 68 20 74 68 65 20 |indows w|ith the |
|00003750| 68 65 6c 70 20 6f 66 20 | 0d 74 68 65 20 76 69 65 |help of |.the vie|
|00003760| 77 20 73 79 73 74 65 6d | 2e 20 48 6f 77 65 76 65 |w system|. Howeve|
|00003770| 72 2c 20 77 65 20 77 69 | 6c 6c 20 72 65 74 61 69 |r, we wi|ll retai|
|00003780| 6e 20 73 6f 6d 65 20 63 | 6f 6e 74 72 6f 6c 20 0d |n some c|ontrol .|
|00003790| 6f 76 65 72 20 68 6f 77 | 20 76 69 65 77 73 20 61 |over how| views a|
|000037a0| 72 65 20 64 69 73 70 6c | 61 79 65 64 2e 20 46 6f |re displ|ayed. Fo|
|000037b0| 72 20 65 78 61 6d 70 6c | 65 2c 20 77 65 20 77 61 |r exampl|e, we wa|
|000037c0| 6e 74 20 74 6f 20 0d 63 | 6f 6e 74 72 6f 6c 20 74 |nt to .c|ontrol t|
|000037d0| 68 65 20 62 61 63 6b 2d | 74 6f 2d 66 72 6f 6e 74 |he back-|to-front|
|000037e0| 20 6f 72 64 65 72 69 6e | 67 20 6f 66 20 67 72 61 | orderin|g of gra|
|000037f0| 70 68 69 63 20 6f 62 6a | 65 63 74 73 20 0d 69 6e |phic obj|ects .in|
|00003800| 20 61 20 77 69 6e 64 6f | 77 2c 20 74 6f 20 62 65 | a windo|w, to be|
|00003810| 20 61 62 6c 65 20 74 6f | 20 6d 6f 76 65 20 6f 62 | able to| move ob|
|00003820| 6a 65 63 74 73 20 61 6d | 6f 6e 67 20 0d 77 69 6e |jects am|ong .win|
|00003830| 64 6f 77 73 2c 20 61 6e | 64 20 74 6f 20 63 6f 6e |dows, an|d to con|
|00003840| 73 74 72 61 69 6e 20 74 | 68 65 20 62 65 68 61 76 |strain t|he behav|
|00003850| 69 6f 72 20 6f 66 20 6f | 62 6a 65 63 74 73 20 0d |ior of o|bjects .|
|00003860| 28 73 75 63 68 20 61 73 | 20 74 6f 6f 6c 73 29 20 |(such as| tools) |
|00003870| 69 6e 20 70 61 6c 65 74 | 74 65 73 2e 0d 0d 4c 65 |in palet|tes...Le|
|00003880| 74 d5 73 20 63 72 65 61 | 74 65 20 61 20 73 75 62 |t.s crea|te a sub|
|00003890| 63 6c 61 73 73 20 6f 66 | 20 74 68 65 20 70 72 65 |class of| the pre|
|000038a0| 64 65 66 69 6e 65 64 20 | 77 69 6e 64 6f 77 20 0d |defined |window .|
|000038b0| 63 6c 61 73 73 20 74 68 | 61 74 20 69 73 20 63 75 |class th|at is cu|
|000038c0| 73 74 6f 6d 69 7a 65 64 | 20 66 6f 72 20 6f 75 72 |stomized| for our|
|000038d0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 20 54 68 | applica|tion. Th|
|000038e0| 69 73 20 63 6c 61 73 73 | 20 0d 77 69 6c 6c 20 69 |is class| .will i|
|000038f0| 6e 63 6c 75 64 65 20 61 | 20 73 6c 6f 74 20 6d 79 |nclude a| slot my|
|00003900| 2d 69 74 65 6d 73 20 74 | 68 61 74 20 77 69 6c 6c |-items t|hat will|
|00003910| 20 68 6f 6c 64 20 61 20 | 6c 69 73 74 20 6f 66 20 | hold a |list of |
|00003920| 0d 61 6c 6c 20 74 68 65 | 20 67 72 61 70 68 69 63 |.all the| graphic|
|00003930| 20 6f 62 6a 65 63 74 73 | 20 74 68 61 74 20 77 65 | objects| that we|
|00003940| 20 64 72 61 77 20 69 6e | 74 6f 20 74 68 65 20 77 | draw in|to the w|
|00003950| 69 6e 64 6f 77 2c 20 0d | 72 65 6d 65 6d 62 65 72 |indow, .|remember|
|00003960| 69 6e 67 20 74 68 65 69 | 72 20 62 61 63 6b 2d 74 |ing thei|r back-t|
|00003970| 6f 2d 66 72 6f 6e 74 20 | 6f 72 64 65 72 69 6e 67 |o-front |ordering|
|00003980| 2e 20 57 65 20 73 74 61 | 72 74 20 62 79 20 0d 63 |. We sta|rt by .c|
|00003990| 72 65 61 74 69 6e 67 20 | 61 20 73 75 62 63 6c 61 |reating |a subcla|
|000039a0| 73 73 20 6f 66 20 74 68 | 65 20 77 69 6e 64 6f 77 |ss of th|e window|
|000039b0| 20 63 6c 61 73 73 20 6e | 61 6d 65 64 20 64 72 61 | class n|amed dra|
|000039c0| 77 2d 0d 64 69 61 6c 6f | 67 2e 20 64 65 66 63 6c |w-.dialo|g. defcl|
|000039d0| 61 73 73 20 69 73 20 74 | 68 65 20 43 4c 4f 53 20 |ass is t|he CLOS |
|000039e0| 66 75 6e 63 74 69 6f 6e | 20 66 6f 72 20 64 65 66 |function| for def|
|000039f0| 69 6e 69 6e 67 20 61 20 | 0d 63 6c 61 73 73 3a 0d |ining a |.class:.|
|00003a00| 0d 28 64 65 66 63 6c 61 | 73 73 20 64 72 61 77 2d |.(defcla|ss draw-|
|00003a10| 64 69 61 6c 6f 67 20 28 | 77 69 6e 64 6f 77 29 0d |dialog (|window).|
|00003a20| 20 20 28 28 6d 79 2d 69 | 74 65 6d 73 20 3a 69 6e | ((my-i|tems :in|
|00003a30| 69 74 66 6f 72 6d 20 4e | 49 4c 29 20 20 20 20 20 |itform N|IL) |
|00003a40| 20 20 20 20 20 20 20 20 | 20 20 20 3b 20 4c 69 73 | | ; Lis|
|00003a50| 74 20 6f 66 20 61 6c 6c | 20 69 74 65 6d 73 20 69 |t of all| items i|
|00003a60| 6e 20 77 69 6e 64 6f 77 | 0d 20 20 20 28 69 74 65 |n window|. (ite|
|00003a70| 6d 2d 6c 61 73 74 2d 75 | 6e 64 65 72 2d 6d 6f 75 |m-last-u|nder-mou|
|00003a80| 73 65 20 3a 69 6e 69 74 | 66 6f 72 6d 20 4e 49 4c |se :init|form NIL|
|00003a90| 29 20 20 20 3b 20 49 74 | 65 6d 20 63 75 72 72 65 |) ; It|em curre|
|00003aa0| 6e 74 6c 79 20 75 6e 64 | 65 72 20 74 68 65 20 6d |ntly und|er the m|
|00003ab0| 6f 75 73 65 0d 20 20 20 | 28 62 72 6f 77 73 65 2d |ouse. |(browse-|
|00003ac0| 6d 6f 64 65 20 3a 69 6e | 69 74 66 6f 72 6d 20 6e |mode :in|itform n|
|00003ad0| 69 6c 29 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |il) | |
|00003ae0| 3b 20 4d 6f 64 65 20 69 | 6e 20 77 68 69 63 68 20 |; Mode i|n which |
|00003af0| 77 69 6e 64 6f 77 20 69 | 73 20 62 65 69 6e 67 20 |window i|s being |
|00003b00| 75 73 65 64 20 28 64 65 | 66 61 75 6c 74 20 3d 20 |used (de|fault = |
|00003b10| 61 75 74 68 6f 72 29 0d | 20 20 20 28 73 65 6c 65 |author).| (sele|
|00003b20| 63 74 69 6f 6e 73 20 3a | 69 6e 69 74 66 6f 72 6d |ctions :|initform|
|00003b30| 20 6e 69 6c 29 20 20 20 | 20 20 20 20 20 20 20 20 | nil) | |
|00003b40| 20 20 20 3b 20 43 75 72 | 72 65 6e 74 6c 79 20 73 | ; Cur|rently s|
|00003b50| 65 6c 65 63 74 65 64 20 | 69 74 65 6d 28 73 29 0d |elected |item(s).|
|00003b60| 20 20 20 28 63 72 65 61 | 74 65 2d 62 79 2d 72 65 | (crea|te-by-re|
|00003b70| 63 74 61 6e 67 6c 65 20 | 3a 69 6e 69 74 66 6f 72 |ctangle |:initfor|
|00003b80| 6d 20 6e 69 6c 29 20 20 | 20 20 20 3b 20 43 61 6e |m nil) | ; Can|
|00003b90| 20 64 72 61 77 2d 69 74 | 65 6d 73 20 62 65 20 63 | draw-it|ems be c|
|00003ba0| 72 65 61 74 65 64 20 62 | 79 20 64 72 61 67 67 69 |reated b|y draggi|
|00003bb0| 6e 67 20 6f 75 74 20 61 | 20 72 65 63 74 61 6e 67 |ng out a| rectang|
|00003bc0| 6c 65 3f 0d 20 20 20 29 | 0d 20 20 28 3a 64 6f 63 |le?. )|. (:doc|
|00003bd0| 75 6d 65 6e 74 61 74 69 | 6f 6e 20 22 54 68 69 73 |umentati|on "This|
|00003be0| 20 63 6c 61 73 73 20 64 | 65 66 69 6e 65 73 20 6f | class d|efines o|
|00003bf0| 75 72 20 77 69 6e 64 6f | 77 73 22 29 29 0d 0d 4f |ur windo|ws"))..O|
|00003c00| 75 72 20 63 6c 61 73 73 | 20 64 72 61 77 2d 64 69 |ur class| draw-di|
|00003c10| 61 6c 6f 67 20 61 64 64 | 73 20 66 69 76 65 20 73 |alog add|s five s|
|00003c20| 6c 6f 74 73 20 6e 61 6d | 65 64 20 6d 79 2d 69 74 |lots nam|ed my-it|
|00003c30| 65 6d 73 2c 0d 62 72 6f | 77 73 65 2d 6d 6f 64 65 |ems,.bro|wse-mode|
|00003c40| 2c 20 69 74 65 6d 2d 6c | 61 73 74 2d 75 6e 64 65 |, item-l|ast-unde|
|00003c50| 72 2d 6d 6f 75 73 65 2c | 20 73 65 6c 65 63 74 69 |r-mouse,| selecti|
|00003c60| 6f 6e 73 20 61 6e 64 0d | 63 72 65 61 74 65 2d 62 |ons and.|create-b|
|00003c70| 79 2d 72 65 63 74 61 6e | 67 6c 65 20 74 6f 20 69 |y-rectan|gle to i|
|00003c80| 74 73 20 73 75 70 65 72 | 63 6c 61 73 73 2c 20 77 |ts super|class, w|
|00003c90| 69 6e 64 6f 77 2e 20 54 | 68 65 20 66 69 72 73 74 |indow. T|he first|
|00003ca0| 0d 61 72 67 75 6d 65 6e | 74 20 74 6f 20 64 65 66 |.argumen|t to def|
|00003cb0| 63 6c 61 73 73 20 69 73 | 20 74 68 65 20 6e 61 6d |class is| the nam|
|00003cc0| 65 20 6f 66 20 74 68 65 | 20 63 6c 61 73 73 2c 20 |e of the| class, |
|00003cd0| 64 72 61 77 2d 64 69 61 | 6c 6f 67 2c 20 0d 66 6f |draw-dia|log, .fo|
|00003ce0| 6c 6c 6f 77 65 64 20 62 | 79 20 61 20 6c 69 73 74 |llowed b|y a list|
|00003cf0| 20 77 69 74 68 20 74 68 | 65 20 6e 61 6d 65 73 20 | with th|e names |
|00003d00| 6f 66 20 61 6c 6c 20 63 | 6c 61 73 73 65 73 2c 20 |of all c|lasses, |
|00003d10| 69 66 20 0d 61 6e 79 2c | 20 66 72 6f 6d 20 77 68 |if .any,| from wh|
|00003d20| 69 63 68 20 77 65 20 77 | 61 6e 74 20 74 6f 20 69 |ich we w|ant to i|
|00003d30| 6e 68 65 72 69 74 20 28 | 74 68 61 74 20 69 73 2c |nherit (|that is,|
|00003d40| 20 74 68 61 74 20 77 65 | 20 0d 77 61 6e 74 20 6f | that we| .want o|
|00003d50| 75 72 20 63 6c 61 73 73 | 20 74 6f 20 62 65 20 61 |ur class| to be a|
|00003d60| 20 73 75 62 63 6c 61 73 | 73 20 6f 66 29 d1 69 6e | subclas|s of).in|
|00003d70| 20 6f 75 72 20 63 61 73 | 65 2c 20 6a 75 73 74 20 | our cas|e, just |
|00003d80| 0d 74 68 65 20 77 69 6e | 64 6f 77 20 63 6c 61 73 |.the win|dow clas|
|00003d90| 73 2e 20 4d 75 6c 74 69 | 70 6c 65 20 69 6e 68 65 |s. Multi|ple inhe|
|00003da0| 72 69 74 61 6e 63 65 20 | 69 73 20 73 75 70 70 6f |ritance |is suppo|
|00003db0| 72 74 65 64 20 0d 61 6e | 64 20 61 6c 74 68 6f 75 |rted .an|d althou|
|00003dc0| 67 68 20 74 68 69 6e 67 | 73 20 61 72 65 2c 20 62 |gh thing|s are, b|
|00003dd0| 79 20 64 65 66 61 75 6c | 74 2c 20 69 6e 68 65 72 |y defaul|t, inher|
|00003de0| 69 74 65 64 20 69 6e 20 | 74 68 65 20 0d 6f 72 64 |ited in |the .ord|
|00003df0| 65 72 20 69 6e 20 77 68 | 69 63 68 20 74 68 65 79 |er in wh|ich they|
|00003e00| 20 61 70 70 65 61 72 20 | 69 6e 20 74 68 69 73 20 | appear |in this |
|00003e10| 6c 69 73 74 2c 20 70 72 | 6f 74 6f 63 6f 6c 73 20 |list, pr|otocols |
|00003e20| 61 72 65 20 0d 61 76 61 | 69 6c 61 62 6c 65 20 69 |are .ava|ilable i|
|00003e30| 6e 20 43 4c 4f 53 20 66 | 6f 72 20 63 6f 6e 74 72 |n CLOS f|or contr|
|00003e40| 6f 6c 6c 69 6e 67 20 74 | 68 69 73 2e 20 54 68 65 |olling t|his. The|
|00003e50| 20 74 68 69 72 64 20 61 | 6e 64 20 0d 66 6f 75 72 | third a|nd .four|
|00003e60| 74 68 20 61 72 67 75 6d | 65 6e 74 73 20 73 68 6f |th argum|ents sho|
|00003e70| 77 6e 20 68 65 72 65 20 | 61 72 65 20 61 20 6c 69 |wn here |are a li|
|00003e80| 73 74 20 6f 66 20 64 65 | 73 63 72 69 70 74 6f 72 |st of de|scriptor|
|00003e90| 73 20 0d 66 6f 72 20 65 | 61 63 68 20 6e 65 77 20 |s .for e|ach new |
|00003ea0| 73 6c 6f 74 20 74 68 61 | 74 20 77 65 20 77 61 6e |slot tha|t we wan|
|00003eb0| 74 20 74 6f 20 64 65 66 | 69 6e 65 20 61 6e 64 20 |t to def|ine and |
|00003ec0| 0d 64 6f 63 75 6d 65 6e | 74 61 74 69 6f 6e 20 74 |.documen|tation t|
|00003ed0| 65 78 74 2c 20 72 65 73 | 70 65 63 74 69 76 65 6c |ext, res|pectivel|
|00003ee0| 79 2e 0d 0d 41 20 64 65 | 73 63 72 69 70 74 6f 72 |y...A de|scriptor|
|00003ef0| 20 69 73 20 61 20 6c 69 | 73 74 20 74 68 61 74 20 | is a li|st that |
|00003f00| 73 74 61 72 74 73 20 77 | 69 74 68 20 74 68 65 20 |starts w|ith the |
|00003f10| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 0d 73 6c 6f |name of |the .slo|
|00003f20| 74 20 66 6f 6c 6c 6f 77 | 65 64 20 62 79 20 61 20 |t follow|ed by a |
|00003f30| 73 65 74 20 6f 66 20 6b | 65 79 77 6f 72 64 2d 76 |set of k|eyword-v|
|00003f40| 61 6c 75 65 20 70 61 69 | 72 73 20 74 68 61 74 20 |alue pai|rs that |
|00003f50| 0d 72 65 70 72 65 73 65 | 6e 74 20 6f 70 74 69 6f |.represe|nt optio|
|00003f60| 6e 73 20 63 6f 6e 63 65 | 72 6e 69 6e 67 20 68 6f |ns conce|rning ho|
|00003f70| 77 20 74 68 65 20 73 6c | 6f 74 73 20 67 65 74 20 |w the sl|ots get |
|00003f80| 0d 69 6e 69 74 69 61 6c | 69 7a 65 64 20 77 68 65 |.initial|ized whe|
|00003f90| 6e 20 61 6e 20 20 69 6e | 73 74 61 6e 63 65 20 6f |n an in|stance o|
|00003fa0| 66 20 74 68 69 73 20 63 | 6c 61 73 73 20 69 73 20 |f this c|lass is |
|00003fb0| 63 72 65 61 74 65 64 2e | 20 0d 57 65 20 75 73 65 |created.| .We use|
|00003fc0| 64 20 74 68 65 20 3a 69 | 6e 69 74 66 6f 72 6d 20 |d the :i|nitform |
|00003fd0| 6b 65 79 77 6f 72 64 20 | 66 6f 6c 6c 6f 77 65 64 |keyword |followed|
|00003fe0| 20 62 79 20 74 68 65 20 | 0d 65 78 70 72 65 73 73 | by the |.express|
|00003ff0| 69 6f 6e 20 4e 49 4c 2e | 20 54 68 69 73 20 6d 65 |ion NIL.| This me|
|00004000| 61 6e 73 20 74 68 61 74 | 20 77 68 65 6e 20 61 6e |ans that| when an|
|00004010| 20 69 6e 73 74 61 6e 63 | 65 20 6f 66 20 0d 64 72 | instanc|e of .dr|
|00004020| 61 77 2d 64 69 61 6c 6f | 67 20 69 73 20 63 72 65 |aw-dialo|g is cre|
|00004030| 61 74 65 64 2c 20 74 68 | 65 20 6d 79 2d 69 74 65 |ated, th|e my-ite|
|00004040| 6d 73 20 73 6c 6f 74 20 | 77 69 6c 6c 20 62 79 20 |ms slot |will by |
|00004050| 0d 64 65 66 61 75 6c 74 | 20 62 65 20 73 65 74 20 |.default| be set |
|00004060| 74 6f 20 77 68 61 74 65 | 76 65 72 20 74 68 65 20 |to whate|ver the |
|00004070| 66 6f 6c 6c 6f 77 69 6e | 67 20 65 78 70 72 65 73 |followin|g expres|
|00004080| 73 69 6f 6e 20 0d 65 76 | 61 6c 75 61 74 65 73 20 |sion .ev|aluates |
|00004090| 74 6f d1 74 68 61 74 20 | 69 73 2c 20 4e 49 4c 2e |to.that |is, NIL.|
|000040a0| 20 0d 0d 54 68 65 20 64 | 72 61 77 2d 64 69 61 6c | ..The d|raw-dial|
|000040b0| 6f 67 20 63 6c 61 73 73 | 20 77 69 6c 6c 20 69 6e |og class| will in|
|000040c0| 68 65 72 69 74 20 73 6c | 6f 74 73 20 66 72 6f 6d |herit sl|ots from|
|000040d0| 20 74 68 65 20 0d 77 69 | 6e 64 6f 77 20 63 6c 61 | the .wi|ndow cla|
|000040e0| 73 73 20 61 6e 64 20 66 | 72 6f 6d 20 74 68 65 20 |ss and f|rom the |
|000040f0| 63 6c 61 73 73 65 73 20 | 69 74 20 69 6e 68 65 72 |classes |it inher|
|00004100| 69 74 73 20 66 72 6f 6d | 2e 20 0d 56 65 72 69 66 |its from|. .Verif|
|00004110| 79 20 74 68 61 74 20 74 | 68 69 73 20 6e 65 77 20 |y that t|his new |
|00004120| 73 75 62 63 6c 61 73 73 | 20 64 65 66 69 6e 69 74 |subclass| definit|
|00004130| 69 6f 6e 20 77 6f 72 6b | 73 20 62 79 20 0d 63 72 |ion work|s by .cr|
|00004140| 65 61 74 69 6e 67 20 61 | 6e 20 69 6e 73 74 61 6e |eating a|n instan|
|00004150| 63 65 20 6f 66 20 69 74 | 3a 0d 0d 28 73 65 74 71 |ce of it|:..(setq|
|00004160| 20 6d 79 2d 77 69 6e 64 | 6f 77 20 28 6d 61 6b 65 | my-wind|ow (make|
|00004170| 2d 69 6e 73 74 61 6e 63 | 65 20 27 64 72 61 77 2d |-instanc|e 'draw-|
|00004180| 64 69 61 6c 6f 67 29 29 | 0d 0d 4f 6e 65 20 77 61 |dialog))|..One wa|
|00004190| 79 20 74 6f 20 63 68 65 | 63 6b 20 77 68 65 74 68 |y to che|ck wheth|
|000041a0| 65 72 20 6f 75 72 20 6e | 65 77 20 73 6c 6f 74 73 |er our n|ew slots|
|000041b0| 20 6d 79 2d 69 74 65 6d | 73 2c 20 0d 62 72 6f 77 | my-item|s, .brow|
|000041c0| 73 65 2d 6d 6f 64 65 2c | 20 69 74 65 6d 2d 6c 61 |se-mode,| item-la|
|000041d0| 73 74 2d 75 6e 64 65 72 | 2d 6d 6f 75 73 65 20 68 |st-under|-mouse h|
|000041e0| 61 76 65 2c 20 73 65 6c | 65 63 74 69 6f 6e 73 20 |ave, sel|ections |
|000041f0| 61 6e 64 0d 63 72 65 61 | 74 65 2d 62 79 2d 72 65 |and.crea|te-by-re|
|00004200| 63 74 61 6e 67 6c 65 20 | 62 65 65 6e 20 61 64 64 |ctangle |been add|
|00004210| 65 64 20 61 6e 64 20 69 | 6e 69 74 69 61 6c 69 7a |ed and i|nitializ|
|00004220| 65 64 20 74 6f 20 74 68 | 65 20 0d 76 61 6c 75 65 |ed to th|e .value|
|00004230| 20 4e 49 4c 2c 20 69 73 | 20 74 6f 20 67 65 74 20 | NIL, is| to get |
|00004240| 74 68 65 69 72 20 73 6c | 6f 74 20 76 61 6c 75 65 |their sl|ot value|
|00004250| 73 20 64 69 72 65 63 74 | 6c 79 2e 20 54 68 65 73 |s direct|ly. Thes|
|00004260| 65 20 0d 76 61 6c 75 65 | 73 20 63 61 6e 20 62 65 |e .value|s can be|
|00004270| 20 6f 62 74 61 69 6e 65 | 64 20 62 79 20 65 76 61 | obtaine|d by eva|
|00004280| 6c 75 61 74 69 6e 67 20 | 74 68 65 20 66 6f 6c 6c |luating |the foll|
|00004290| 6f 77 69 6e 67 20 0d 65 | 78 70 72 65 73 73 69 6f |owing .e|xpressio|
|000042a0| 6e 73 3a 0d 0d 28 73 6c | 6f 74 2d 76 61 6c 75 65 |ns:..(sl|ot-value|
|000042b0| 20 6d 79 2d 77 69 6e 64 | 6f 77 20 27 6d 79 2d 69 | my-wind|ow 'my-i|
|000042c0| 74 65 6d 73 29 20 20 3b | 20 52 65 74 75 72 6e 73 |tems) ;| Returns|
|000042d0| 20 76 61 6c 75 65 20 6f | 66 20 73 6c 6f 74 20 6d | value o|f slot m|
|000042e0| 79 2d 69 74 65 6d 73 0d | 28 73 6c 6f 74 2d 76 61 |y-items.|(slot-va|
|000042f0| 6c 75 65 20 6d 79 2d 77 | 69 6e 64 6f 77 20 27 62 |lue my-w|indow 'b|
|00004300| 72 6f 77 73 65 2d 6d 6f | 64 65 29 0d 28 73 6c 6f |rowse-mo|de).(slo|
|00004310| 74 2d 76 61 6c 75 65 20 | 6d 79 2d 77 69 6e 64 6f |t-value |my-windo|
|00004320| 77 20 27 69 74 65 6d 2d | 6c 61 73 74 2d 75 6e 64 |w 'item-|last-und|
|00004330| 65 72 2d 6d 6f 75 73 65 | 29 0d 28 73 6c 6f 74 2d |er-mouse|).(slot-|
|00004340| 76 61 6c 75 65 20 6d 79 | 2d 77 69 6e 64 6f 77 20 |value my|-window |
|00004350| 27 73 65 6c 65 63 74 69 | 6f 6e 73 29 0d 28 73 6c |'selecti|ons).(sl|
|00004360| 6f 74 2d 76 61 6c 75 65 | 20 6d 79 2d 77 69 6e 64 |ot-value| my-wind|
|00004370| 6f 77 20 27 63 72 65 61 | 74 65 2d 62 79 2d 72 65 |ow 'crea|te-by-re|
|00004380| 63 74 61 6e 67 6c 65 29 | 0d 0d 41 6e 6f 74 68 65 |ctangle)|..Anothe|
|00004390| 72 20 77 61 79 20 74 6f | 20 63 68 65 63 6b 20 74 |r way to| check t|
|000043a0| 68 65 73 65 20 73 6c 6f | 74 73 20 69 73 20 62 79 |hese slo|ts is by|
|000043b0| 20 75 73 69 6e 67 20 74 | 68 65 20 4c 69 73 70 20 | using t|he Lisp |
|000043c0| 0d 69 6e 73 70 65 63 74 | 6f 72 20 74 6f 20 76 69 |.inspect|or to vi|
|000043d0| 65 77 20 74 68 65 20 6f | 62 6a 65 63 74 20 69 6e |ew the o|bject in|
|000043e0| 73 74 61 6e 63 65 2e 20 | 54 68 65 20 69 6e 73 70 |stance. |The insp|
|000043f0| 65 63 74 6f 72 20 0d 70 | 72 6f 76 69 64 65 73 20 |ector .p|rovides |
|00004400| 75 73 20 77 69 74 68 20 | 61 20 64 65 73 63 72 69 |us with |a descri|
|00004410| 70 74 69 6f 6e 20 6f 66 | 20 61 6e 79 20 6f 62 6a |ption of| any obj|
|00004420| 65 63 74 20 28 74 68 69 | 73 20 0d 69 6e 63 6c 75 |ect (thi|s .inclu|
|00004430| 64 65 73 20 63 6f 6e 73 | 74 61 6e 74 73 2c 20 76 |des cons|tants, v|
|00004440| 61 72 69 61 62 6c 65 73 | 2c 20 61 6e 64 20 66 75 |ariables|, and fu|
|00004450| 6e 63 74 69 6f 6e 73 29 | 20 74 68 61 74 20 77 65 |nctions)| that we|
|00004460| 20 0d 77 61 6e 74 20 74 | 6f 20 6c 6f 6f 6b 20 61 | .want t|o look a|
|00004470| 74 2e 20 28 49 6e 20 61 | 64 64 69 74 69 6f 6e 2c |t. (In a|ddition,|
|00004480| 20 61 73 20 6f 66 20 74 | 68 69 73 20 77 72 69 74 | as of t|his writ|
|00004490| 69 6e 67 2c 20 74 68 65 | 20 0d 72 65 6c 65 61 73 |ing, the| .releas|
|000044a0| 65 64 20 76 65 72 73 69 | 6f 6e 20 6f 66 20 74 68 |ed versi|on of th|
|000044b0| 65 20 4d 43 4c 20 32 2e | 30 20 69 6e 73 70 65 63 |e MCL 2.|0 inspec|
|000044c0| 74 6f 72 20 77 69 6c 6c | 20 61 6c 6c 6f 77 20 0d |tor will| allow .|
|000044d0| 79 6f 75 20 74 6f 20 64 | 69 72 65 63 74 6c 79 20 |you to d|irectly |
|000044e0| 65 64 69 74 20 76 61 6c | 75 65 73 2e 29 20 54 6f |edit val|ues.) To|
|000044f0| 20 69 6e 73 70 65 63 74 | 20 74 68 65 20 69 6e 73 | inspect| the ins|
|00004500| 74 61 6e 63 65 20 69 6e | 20 0d 6d 79 2d 77 69 6e |tance in| .my-win|
|00004510| 64 6f 77 2c 20 65 76 61 | 6c 75 61 74 65 20 28 69 |dow, eva|luate (i|
|00004520| 6e 73 70 65 63 74 20 6d | 79 2d 77 69 6e 64 6f 77 |nspect m|y-window|
|00004530| 29 2c 20 77 68 69 63 68 | 20 0d 62 72 69 6e 67 73 |), which| .brings|
|00004540| 20 75 70 20 61 20 73 63 | 72 65 65 6e 20 74 68 61 | up a sc|reen tha|
|00004550| 74 20 6c 6f 6f 6b 73 20 | 6c 69 6b 65 20 46 69 67 |t looks |like Fig|
|00004560| 75 72 65 20 31 2e 0d 0d | 46 69 67 75 72 65 20 31 |ure 1...|Figure 1|
|00004570| 3a 20 5b 20 53 65 65 20 | 46 69 67 75 72 65 20 33 |: [ See |Figure 3|
|00004580| 20 69 6e 20 64 65 76 65 | 6c 6f 70 2c 20 70 31 30 | in deve|lop, p10|
|00004590| 34 20 5d 0d 0d 56 69 65 | 77 69 6e 67 20 61 6e 20 |4 ]..Vie|wing an |
|000045a0| 49 6e 73 74 61 6e 63 65 | 20 6f 66 20 74 68 65 20 |Instance| of the |
|000045b0| 64 72 61 77 2d 64 69 61 | 6c 6f 67 20 43 6c 61 73 |draw-dia|log Clas|
|000045c0| 73 20 69 6e 20 74 68 65 | 20 0d 49 6e 73 70 65 63 |s in the| .Inspec|
|000045d0| 74 6f 72 0d 0d 54 68 65 | 20 69 74 65 6d 73 20 66 |tor..The| items f|
|000045e0| 6f 6c 6c 6f 77 69 6e 67 | 20 4c 6f 63 61 6c 20 73 |ollowing| Local s|
|000045f0| 6c 6f 74 73 3a 20 61 72 | 65 20 73 6c 6f 74 73 20 |lots: ar|e slots |
|00004600| 6f 66 20 74 68 65 20 0d | 6f 62 6a 65 63 74 20 62 |of the .|object b|
|00004610| 6f 75 6e 64 20 74 6f 20 | 6d 79 2d 77 69 6e 64 6f |ound to |my-windo|
|00004620| 77 2e 20 54 68 65 20 73 | 6c 6f 74 73 20 74 68 61 |w. The s|lots tha|
|00004630| 74 20 77 65 20 61 64 64 | 65 64 20 0d 73 68 6f 75 |t we add|ed .shou|
|00004640| 6c 64 20 62 65 20 61 74 | 20 74 68 65 20 74 6f 70 |ld be at| the top|
|00004650| 2c 20 61 73 20 73 68 6f | 77 6e 3b 20 74 68 65 20 |, as sho|wn; the |
|00004660| 72 65 6d 61 69 6e 69 6e | 67 20 73 6c 6f 74 73 20 |remainin|g slots |
|00004670| 0d 68 61 76 65 20 62 65 | 65 6e 20 69 6e 68 65 72 |.have be|en inher|
|00004680| 69 74 65 64 20 66 72 6f | 6d 20 74 68 65 20 77 69 |ited fro|m the wi|
|00004690| 6e 64 6f 77 20 63 6c 61 | 73 73 2e 20 46 6f 72 20 |ndow cla|ss. For |
|000046a0| 0d 65 78 61 6d 70 6c 65 | 2c 20 74 68 65 20 73 6c |.example|, the sl|
|000046b0| 6f 74 20 77 70 74 72 20 | 63 6f 6e 74 61 69 6e 73 |ot wptr |contains|
|000046c0| 20 74 68 65 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 | the poi|nter to |
|000046d0| 74 68 65 20 0d 4d 61 63 | 69 6e 74 6f 73 68 20 77 |the .Mac|intosh w|
|000046e0| 69 6e 64 6f 77 20 64 65 | 66 69 6e 69 74 69 6f 6e |indow de|finition|
|000046f0| 20 62 6c 6f 63 6b 2c 20 | 61 6e 64 20 76 69 65 77 | block, |and view|
|00004700| 2d 73 69 7a 65 20 69 73 | 20 0d 74 68 65 20 70 6f |-size is| .the po|
|00004710| 69 6e 74 20 28 74 68 61 | 74 20 69 73 2c 20 61 20 |int (tha|t is, a |
|00004720| 6c 6f 6e 67 20 75 73 65 | 64 20 61 73 20 61 20 70 |long use|d as a p|
|00004730| 6f 69 6e 74 29 20 66 6f | 72 20 74 68 65 20 0d 77 |oint) fo|r the .w|
|00004740| 69 6e 64 6f 77 d5 73 20 | 73 69 7a 65 2e 20 59 6f |indow.s |size. Yo|
|00004750| 75 20 73 68 6f 75 6c 64 | 20 72 65 73 69 73 74 20 |u should| resist |
|00004760| 74 68 65 20 74 65 6d 70 | 74 61 74 69 6f 6e 20 74 |the temp|tation t|
|00004770| 6f 20 0d 64 69 72 65 63 | 74 6c 79 20 61 63 63 65 |o .direc|tly acce|
|00004780| 73 73 20 74 68 65 73 65 | 20 73 6c 6f 74 73 2c 20 |ss these| slots, |
|00004790| 75 6e 6c 65 73 73 20 79 | 6f 75 20 61 62 73 6f 6c |unless y|ou absol|
|000047a0| 75 74 65 6c 79 20 6e 65 | 65 64 20 0d 74 6f 2e 20 |utely ne|ed .to. |
|000047b0| 54 68 65 20 70 72 65 64 | 65 66 69 6e 65 64 20 77 |The pred|efined w|
|000047c0| 69 6e 64 6f 77 20 6d 65 | 74 68 6f 64 73 2c 20 6c |indow me|thods, l|
|000047d0| 69 6b 65 20 73 65 74 2d | 76 69 65 77 2d 0d 73 69 |ike set-|view-.si|
|000047e0| 7a 65 2c 20 73 68 6f 75 | 6c 64 20 62 65 20 75 73 |ze, shou|ld be us|
|000047f0| 65 64 20 69 6e 73 74 65 | 61 64 2e 20 49 66 20 79 |ed inste|ad. If y|
|00004800| 6f 75 d5 64 20 6c 69 6b | 65 20 74 6f 20 69 6e 73 |ou.d lik|e to ins|
|00004810| 70 65 63 74 20 0d 74 68 | 65 20 77 69 6e 64 6f 77 |pect .th|e window|
|00004820| 20 62 6c 6f 63 6b 20 69 | 74 73 65 6c 66 2c 20 79 | block i|tself, y|
|00004830| 6f 75 20 63 61 6e 20 64 | 6f 75 62 6c 65 2d 63 6c |ou can d|ouble-cl|
|00004840| 69 63 6b 20 6f 6e 20 74 | 68 65 20 0d 6c 69 6e 65 |ick on t|he .line|
|00004850| 20 69 6e 20 46 69 67 75 | 72 65 20 31 20 77 69 74 | in Figu|re 1 wit|
|00004860| 68 20 74 68 65 20 77 70 | 74 72 20 74 6f 20 67 65 |h the wp|tr to ge|
|00004870| 74 20 74 68 65 20 64 69 | 73 70 6c 61 79 20 73 68 |t the di|splay sh|
|00004880| 6f 77 6e 20 0d 69 6e 20 | 46 69 67 75 72 65 20 32 |own .in |Figure 2|
|00004890| 2e 0d 0d 46 69 67 75 72 | 65 20 32 3a 20 5b 20 53 |...Figur|e 2: [ S|
|000048a0| 65 65 20 46 69 67 75 72 | 65 20 34 20 69 6e 20 64 |ee Figur|e 4 in d|
|000048b0| 65 76 65 6c 6f 70 2c 20 | 70 31 30 35 20 5d 0d 0d |evelop, |p105 ]..|
|000048c0| 56 69 65 77 69 6e 67 20 | 74 68 65 20 57 69 6e 64 |Viewing |the Wind|
|000048d0| 6f 77 20 52 65 63 6f 72 | 64 20 66 6f 72 20 4f 75 |ow Recor|d for Ou|
|000048e0| 72 20 49 6e 73 74 61 6e | 63 65 20 6f 66 20 0d 64 |r Instan|ce of .d|
|000048f0| 72 61 77 2d 64 69 61 6c | 6f 67 20 69 6e 20 74 68 |raw-dial|og in th|
|00004900| 65 20 49 6e 73 70 65 63 | 74 6f 72 0d 0d 59 6f 75 |e Inspec|tor..You|
|00004910| 20 63 6f 75 6c 64 20 63 | 6f 6e 74 69 6e 75 65 20 | could c|ontinue |
|00004920| 74 68 69 73 20 70 72 6f | 63 65 73 73 20 69 6e 64 |this pro|cess ind|
|00004930| 65 66 69 6e 69 74 65 6c | 79 d1 66 6f 72 20 0d 65 |efinitel|y.for .e|
|00004940| 78 61 6d 70 6c 65 2c 20 | 6c 6f 6f 6b 69 6e 67 20 |xample, |looking |
|00004950| 6e 65 78 74 20 61 74 20 | 74 68 65 20 72 65 63 74 |next at |the rect|
|00004960| 61 6e 67 6c 65 20 72 65 | 63 6f 72 64 73 20 69 6e |angle re|cords in|
|00004970| 20 74 68 65 20 0d 77 69 | 6e 64 6f 77 20 72 65 63 | the .wi|ndow rec|
|00004980| 6f 72 64 2e 20 41 73 20 | 79 6f 75 20 6c 6f 6f 6b |ord. As |you look|
|00004990| 20 61 74 20 74 68 65 73 | 65 20 6c 6f 77 65 72 2d | at thes|e lower-|
|000049a0| 6c 65 76 65 6c 20 0d 73 | 74 72 75 63 74 75 72 65 |level .s|tructure|
|000049b0| 73 2c 20 79 6f 75 20 62 | 65 67 69 6e 20 74 6f 20 |s, you b|egin to |
|000049c0| 73 65 65 20 74 68 61 74 | 20 61 6c 74 68 6f 75 67 |see that| althoug|
|000049d0| 68 20 4c 69 73 70 20 69 | 73 20 61 20 0d 76 65 72 |h Lisp i|s a .ver|
|000049e0| 79 20 68 69 67 68 2d 6c | 65 76 65 6c 20 6c 61 6e |y high-l|evel lan|
|000049f0| 67 75 61 67 65 2c 20 79 | 6f 75 20 63 61 6e 20 73 |guage, y|ou can s|
|00004a00| 74 69 6c 6c 20 61 63 63 | 65 73 73 20 74 68 65 20 |till acc|ess the |
|00004a10| 0d 73 79 73 74 65 6d 20 | 61 73 20 69 66 20 77 72 |.system |as if wr|
|00004a20| 69 74 69 6e 67 20 69 6e | 20 61 73 73 65 6d 62 6c |iting in| assembl|
|00004a30| 65 72 20 6c 61 6e 67 75 | 61 67 65 2e 20 41 73 20 |er langu|age. As |
|00004a40| 77 65 20 0d 73 68 61 6c | 6c 20 73 65 65 20 6c 61 |we .shal|l see la|
|00004a50| 74 65 72 2c 20 74 68 69 | 73 20 63 6c 61 72 69 66 |ter, thi|s clarif|
|00004a60| 69 65 73 20 74 6f 6f 6c | 62 6f 78 20 61 63 63 65 |ies tool|box acce|
|00004a70| 73 73 20 0d 63 6f 6e 73 | 69 64 65 72 61 62 6c 79 |ss .cons|iderably|
|00004a80| 20 77 68 65 6e 20 63 6f | 6d 70 61 72 65 64 20 77 | when co|mpared w|
|00004a90| 69 74 68 20 43 20 61 6e | 64 20 50 61 73 63 61 6c |ith C an|d Pascal|
|00004aa0| 2e 0d 0d 4e 6f 77 2c 20 | 77 65 20 77 61 6e 74 20 |...Now, |we want |
|00004ab0| 74 6f 20 64 65 66 69 6e | 65 20 74 68 65 20 62 65 |to defin|e the be|
|00004ac0| 68 61 76 69 6f 72 20 6f | 66 20 6f 75 72 20 0d 77 |havior o|f our .w|
|00004ad0| 69 6e 64 6f 77 d1 77 68 | 61 74 20 68 61 70 70 65 |indow.wh|at happe|
|00004ae0| 6e 73 20 77 68 65 6e 20 | 69 74 20 69 73 20 63 72 |ns when |it is cr|
|00004af0| 65 61 74 65 64 2c 20 77 | 68 65 6e 20 69 74 20 69 |eated, w|hen it i|
|00004b00| 73 20 0d 63 6c 6f 73 65 | 64 2c 20 77 68 65 6e 20 |s .close|d, when |
|00004b10| 74 68 69 6e 67 73 20 61 | 72 65 20 61 64 64 65 64 |things a|re added|
|00004b20| 20 74 6f 20 69 74 2c 20 | 77 68 65 6e 20 74 68 65 | to it, |when the|
|00004b30| 20 6d 6f 75 73 65 20 69 | 73 20 0d 63 6c 69 63 6b | mouse i|s .click|
|00004b40| 65 64 20 6f 6e 20 69 74 | 2c 20 61 6e 64 20 73 6f |ed on it|, and so|
|00004b50| 20 6f 6e 2e 20 46 6f 72 | 74 75 6e 61 74 65 6c 79 | on. For|tunately|
|00004b60| 2c 20 6d 75 63 68 20 6f | 66 20 74 68 69 73 20 0d |, much o|f this .|
|00004b70| 62 65 68 61 76 69 6f 72 | 20 69 73 20 61 6c 72 65 |behavior| is alre|
|00004b80| 61 64 79 20 68 61 6e 64 | 6c 65 64 20 66 6f 72 20 |ady hand|led for |
|00004b90| 75 73 20 62 79 20 74 68 | 65 20 70 72 65 64 65 66 |us by th|e predef|
|00004ba0| 69 6e 65 64 20 0d 77 69 | 6e 64 6f 77 20 6d 65 74 |ined .wi|ndow met|
|00004bb0| 68 6f 64 73 2e 20 0d 0d | 49 6e 20 6f 75 72 20 6d |hods. ..|In our m|
|00004bc0| 65 6e 75 20 73 65 63 74 | 69 6f 6e 20 61 62 6f 76 |enu sect|ion abov|
|00004bd0| 65 2c 20 77 65 20 64 65 | 66 69 6e 65 64 20 66 6f |e, we de|fined fo|
|00004be0| 72 20 74 68 65 20 46 69 | 6c 65 20 0d 6d 65 6e 75 |r the Fi|le .menu|
|00004bf0| 20 74 68 65 20 4e 65 77 | 20 6d 65 6e 75 20 69 74 | the New| menu it|
|00004c00| 65 6d 20 77 68 69 63 68 | 2c 20 77 68 65 6e 20 63 |em which|, when c|
|00004c10| 68 6f 73 65 6e 2c 20 63 | 61 6c 6c 65 64 20 0d 74 |hosen, c|alled .t|
|00004c20| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 6e 65 77 2d |he funct|ion new-|
|00004c30| 6d 65 6e 75 2d 69 74 65 | 6d 2d 61 63 74 69 6f 6e |menu-ite|m-action|
|00004c40| 2e 20 57 65 20 61 72 65 | 20 6e 6f 77 20 0d 72 65 |. We are| now .re|
|00004c50| 61 64 79 20 74 6f 20 64 | 65 66 69 6e 65 20 74 68 |ady to d|efine th|
|00004c60| 69 73 20 66 75 6e 63 74 | 69 6f 6e 2c 20 77 68 69 |is funct|ion, whi|
|00004c70| 63 68 20 63 72 65 61 74 | 65 73 20 61 6e 20 0d 69 |ch creat|es an .i|
|00004c80| 6e 73 74 61 6e 63 65 20 | 6f 66 20 61 20 64 72 61 |nstance |of a dra|
|00004c90| 77 2d 64 69 61 6c 6f 67 | 20 77 69 6e 64 6f 77 3a |w-dialog| window:|
|00004ca0| 0d 0d 28 64 65 66 76 61 | 72 20 2a 77 69 6e 64 6f |..(defva|r *windo|
|00004cb0| 77 2d 63 6f 75 6e 74 2a | 20 30 29 20 20 20 3b 20 |w-count*| 0) ; |
|00004cc0| 46 6f 72 20 61 20 6e 65 | 77 20 77 69 6e 64 6f 77 |For a ne|w window|
|00004cd0| d5 73 20 74 69 74 6c 65 | 0d 0d 28 64 65 66 75 6e |.s title|..(defun|
|00004ce0| 20 6e 65 77 2d 6d 65 6e | 75 2d 69 74 65 6d 2d 61 | new-men|u-item-a|
|00004cf0| 63 74 69 6f 6e 20 28 29 | 0d 20 20 28 6d 61 6b 65 |ction ()|. (make|
|00004d00| 2d 69 6e 73 74 61 6e 63 | 65 20 27 64 72 61 77 2d |-instanc|e 'draw-|
|00004d10| 64 69 61 6c 6f 67 0d 20 | 20 20 20 3a 77 69 6e 64 |dialog. | :wind|
|00004d20| 6f 77 2d 74 69 74 6c 65 | 0d 20 20 20 20 28 66 6f |ow-title|. (fo|
|00004d30| 72 6d 61 74 20 6e 69 6c | 20 22 44 72 61 77 20 44 |rmat nil| "Draw D|
|00004d40| 69 61 6c 6f 67 20 7e 61 | 22 20 28 69 6e 63 66 20 |ialog ~a|" (incf |
|00004d50| 2a 77 69 6e 64 6f 77 2d | 63 6f 75 6e 74 2a 29 29 |*window-|count*))|
|00004d60| 0d 20 20 20 20 3a 76 69 | 65 77 2d 73 69 7a 65 20 |. :vi|ew-size |
|00004d70| 28 6d 61 6b 65 2d 70 6f | 69 6e 74 20 28 2d 20 2a |(make-po|int (- *|
|00004d80| 73 63 72 65 65 6e 2d 77 | 69 64 74 68 2a 20 31 35 |screen-w|idth* 15|
|00004d90| 30 29 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |0). | |
|00004da0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 28 2d | | (-|
|00004db0| 20 2a 73 63 72 65 65 6e | 2d 68 65 69 67 68 74 2a | *screen|-height*|
|00004dc0| 20 31 30 30 29 29 0d 20 | 20 20 20 3a 76 69 65 77 | 100)). | :view|
|00004dd0| 2d 70 6f 73 69 74 69 6f | 6e 20 28 6d 61 6b 65 2d |-positio|n (make-|
|00004de0| 70 6f 69 6e 74 20 35 20 | 34 30 29 0d 20 20 20 20 |point 5 |40). |
|00004df0| 3a 63 6f 6c 6f 72 2d 70 | 20 2a 63 6f 6c 6f 72 2d |:color-p| *color-|
|00004e00| 61 76 61 69 6c 61 62 6c | 65 2a 0d 20 20 20 20 3a |availabl|e*. :|
|00004e10| 77 69 6e 64 6f 77 2d 74 | 79 70 65 20 3a 64 6f 63 |window-t|ype :doc|
|00004e20| 75 6d 65 6e 74 2d 77 69 | 74 68 2d 7a 6f 6f 6d 29 |ument-wi|th-zoom)|
|00004e30| 29 0d 0d 57 65 20 75 73 | 65 64 20 74 68 65 20 4c |)..We us|ed the L|
|00004e40| 69 73 70 20 66 6f 72 6d | 61 74 20 73 74 61 74 65 |isp form|at state|
|00004e50| 6d 65 6e 74 20 74 6f 20 | 63 72 65 61 74 65 20 74 |ment to |create t|
|00004e60| 68 65 20 0d 77 69 6e 64 | 6f 77 20 74 69 74 6c 65 |he .wind|ow title|
|00004e70| 2e 20 66 6f 72 6d 61 74 | 20 69 73 20 61 20 73 6f |. format| is a so|
|00004e80| 70 68 69 73 74 69 63 61 | 74 65 64 20 69 6e 73 74 |phistica|ted inst|
|00004e90| 72 75 6d 65 6e 74 20 0d | 6e 6f 74 20 6f 6e 6c 79 |rument .|not only|
|00004ea0| 20 66 6f 72 20 77 72 69 | 74 69 6e 67 20 73 74 72 | for wri|ting str|
|00004eb0| 69 6e 67 73 20 74 6f 20 | 61 6e 79 20 73 74 72 65 |ings to |any stre|
|00004ec0| 61 6d 2c 20 62 75 74 20 | 61 6c 73 6f 20 66 6f 72 |am, but |also for|
|00004ed0| 20 0d 67 65 6e 65 72 61 | 74 69 6e 67 20 73 74 72 | .genera|ting str|
|00004ee0| 69 6e 67 20 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |ing expr|essions |
|00004ef0| 6f 66 20 61 72 62 69 74 | 72 61 72 79 20 63 6f 6d |of arbit|rary com|
|00004f00| 70 6c 65 78 69 74 79 2e | 20 0d 57 65 20 75 73 65 |plexity.| .We use|
|00004f10| 20 74 68 65 20 3a 77 69 | 6e 64 6f 77 2d 74 79 70 | the :wi|ndow-typ|
|00004f20| 65 20 6f 70 74 69 6f 6e | 20 74 6f 20 72 65 71 75 |e option| to requ|
|00004f30| 69 72 65 20 61 20 0d 64 | 6f 63 75 6d 65 6e 74 20 |ire a .d|ocument |
|00004f40| 77 69 74 68 20 7a 6f 6f | 6d 20 62 6f 78 2e 20 2a |with zoo|m box. *|
|00004f50| 73 63 72 65 65 6e 2d 77 | 69 64 74 68 2a 20 61 6e |screen-w|idth* an|
|00004f60| 64 20 0d 2a 73 63 72 65 | 65 6e 2d 68 65 69 67 68 |d .*scre|en-heigh|
|00004f70| 74 2a 20 61 72 65 20 74 | 68 65 20 6d 61 69 6e 20 |t* are t|he main |
|00004f80| 73 63 72 65 65 6e d5 73 | 20 77 69 64 74 68 20 61 |screen.s| width a|
|00004f90| 6e 64 20 0d 68 65 69 67 | 68 74 2c 20 72 65 73 70 |nd .heig|ht, resp|
|00004fa0| 65 63 74 69 76 65 6c 79 | 2c 20 77 68 69 63 68 20 |ectively|, which |
|00004fb0| 61 72 65 20 73 75 70 70 | 6c 69 65 64 20 62 79 20 |are supp|lied by |
|00004fc0| 4d 43 4c 2e 20 0d 46 69 | 6e 61 6c 6c 79 2c 20 69 |MCL. .Fi|nally, i|
|00004fd0| 6e 63 66 20 69 73 20 61 | 20 6d 61 63 72 6f 20 74 |ncf is a| macro t|
|00004fe0| 68 61 74 20 6c 65 74 73 | 20 75 73 20 69 6e 63 72 |hat lets| us incr|
|00004ff0| 65 6d 65 6e 74 20 61 6e | 64 20 73 65 74 20 0d 74 |ement an|d set .t|
|00005000| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 2a 77 69 6e |he value| of *win|
|00005010| 64 6f 77 2d 63 6f 75 6e | 74 2a 2e 0d 0d 4f 6e 65 |dow-coun|t*...One|
|00005020| 20 69 6e 74 65 72 65 73 | 74 69 6e 67 20 62 65 68 | interes|ting beh|
|00005030| 61 76 69 6f 72 20 74 68 | 61 74 20 77 65 20 77 61 |avior th|at we wa|
|00005040| 6e 74 20 74 6f 20 61 64 | 64 20 74 6f 20 64 72 61 |nt to ad|d to dra|
|00005050| 77 2d 0d 64 69 61 6c 6f | 67 20 69 73 20 74 6f 20 |w-.dialo|g is to |
|00005060| 6d 61 6b 65 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |make the| window |
|00005070| 68 61 6e 64 6c 65 20 65 | 76 65 6e 74 73 20 6c 69 |handle e|vents li|
|00005080| 6b 65 20 0d 48 79 70 65 | 72 43 61 72 64 20 64 6f |ke .Hype|rCard do|
|00005090| 65 73 2e 20 54 68 65 20 | 63 6f 6e 63 65 70 74 20 |es. The |concept |
|000050a0| 69 73 20 74 68 61 74 20 | 61 6e 20 69 6e 73 74 61 |is that |an insta|
|000050b0| 6e 63 65 20 6f 66 20 0d | 64 72 61 77 2d 64 69 61 |nce of .|draw-dia|
|000050c0| 6c 6f 67 2c 20 61 73 20 | 77 65 6c 6c 20 61 73 20 |log, as |well as |
|000050d0| 61 6e 79 20 6f 62 6a 65 | 63 74 20 69 6e 20 69 74 |any obje|ct in it|
|000050e0| 2c 20 63 61 6e 20 62 65 | 20 0d 73 63 72 69 70 74 |, can be| .script|
|000050f0| 65 64 2e 20 41 20 73 63 | 72 69 70 74 20 77 69 6c |ed. A sc|ript wil|
|00005100| 6c 20 68 65 72 65 20 62 | 65 20 64 65 66 69 6e 65 |l here b|e define|
|00005110| 64 20 61 73 20 61 20 73 | 65 74 20 6f 66 20 0d 68 |d as a s|et of .h|
|00005120| 61 6e 64 6c 65 72 73 2e | 20 49 6e 73 74 65 61 64 |andlers.| Instead|
|00005130| 20 6f 66 20 68 61 76 69 | 6e 67 20 61 20 73 63 72 | of havi|ng a scr|
|00005140| 69 70 74 69 6e 67 20 6c | 61 6e 67 75 61 67 65 20 |ipting l|anguage |
|00005150| 6c 69 6b 65 20 0d 48 79 | 70 65 72 54 61 6c 6b 2c |like .Hy|perTalk,|
|00005160| 20 77 65 d5 6c 6c 20 75 | 73 65 20 4c 69 73 70 2c | we.ll u|se Lisp,|
|00005170| 20 77 68 69 63 68 20 69 | 73 20 68 61 6e 64 69 65 | which i|s handie|
|00005180| 72 2e 20 41 20 68 61 6e | 64 6c 65 72 20 0d 77 69 |r. A han|dler .wi|
|00005190| 6c 6c 20 62 65 20 61 20 | 6d 65 74 68 6f 64 20 77 |ll be a |method w|
|000051a0| 68 6f 73 65 20 6e 61 6d | 65 20 69 73 20 74 68 65 |hose nam|e is the|
|000051b0| 20 6e 61 6d 65 20 6f 66 | 20 74 68 65 20 0d 68 61 | name of| the .ha|
|000051c0| 6e 64 6c 65 72 2e 20 54 | 68 65 20 66 6f 6c 6c 6f |ndler. T|he follo|
|000051d0| 77 69 6e 67 20 74 79 70 | 65 73 20 6f 66 20 68 61 |wing typ|es of ha|
|000051e0| 6e 64 6c 65 72 73 20 77 | 69 6c 6c 20 74 68 65 72 |ndlers w|ill ther|
|000051f0| 65 66 6f 72 65 20 0d 62 | 65 20 64 65 66 69 6e 65 |efore .b|e define|
|00005200| 64 3a 0d 0d 69 64 6c 65 | 09 09 09 50 65 72 69 6f |d:..idle|...Perio|
|00005210| 64 69 63 61 6c 6c 79 20 | 63 61 6c 6c 65 64 20 62 |dically |called b|
|00005220| 79 20 74 68 65 20 73 79 | 73 74 65 6d 2e 0d 0d 6d |y the sy|stem...m|
|00005230| 6f 75 73 65 2d 65 6e 74 | 65 72 09 20 20 20 20 20 |ouse-ent|er. |
|00005240| 20 20 20 43 61 6c 6c 65 | 64 20 77 68 65 6e 65 76 | Calle|d whenev|
|00005250| 65 72 20 74 68 65 20 6d | 6f 75 73 65 20 65 6e 74 |er the m|ouse ent|
|00005260| 65 72 73 20 74 68 65 0d | 09 09 09 62 6f 75 6e 64 |ers the.|...bound|
|00005270| 73 20 6f 66 20 74 68 65 | 20 6f 62 6a 65 63 74 2e |s of the| object.|
|00005280| 0d 0d 6d 6f 75 73 65 2d | 6c 65 61 76 65 09 20 20 |..mouse-|leave. |
|00005290| 20 20 20 20 20 20 43 61 | 6c 6c 65 64 20 77 68 65 | Ca|lled whe|
|000052a0| 6e 65 76 65 72 20 74 68 | 65 20 6d 6f 75 73 65 20 |never th|e mouse |
|000052b0| 6c 65 61 76 65 73 20 74 | 68 65 0d 20 09 09 09 62 |leaves t|he. ...b|
|000052c0| 6f 75 6e 64 73 20 6f 66 | 20 74 68 65 20 6f 62 6a |ounds of| the obj|
|000052d0| 65 63 74 2e 0d 0d 6d 6f | 75 73 65 2d 77 69 74 68 |ect...mo|use-with|
|000052e0| 69 6e 09 20 20 20 20 20 | 20 20 20 50 65 72 69 6f |in. | Perio|
|000052f0| 64 69 63 61 6c 6c 79 20 | 63 61 6c 6c 65 64 20 77 |dically |called w|
|00005300| 68 69 6c 65 20 74 68 65 | 20 6d 6f 75 73 65 20 69 |hile the| mouse i|
|00005310| 73 20 0d 09 09 09 77 69 | 74 68 69 6e 20 74 68 65 |s ....wi|thin the|
|00005320| 20 62 6f 75 6e 64 73 20 | 6f 66 20 74 68 65 20 6f | bounds |of the o|
|00005330| 62 6a 65 63 74 2e 0d 0d | 6b 65 79 09 09 09 43 61 |bject...|key...Ca|
|00005340| 6c 6c 65 64 20 77 68 65 | 6e 65 76 65 72 20 74 68 |lled whe|never th|
|00005350| 65 20 6f 62 6a 65 63 74 | 20 69 73 20 73 65 6c 65 |e object| is sele|
|00005360| 63 74 65 64 20 0d 09 09 | 09 61 6e 64 20 61 20 6b |cted ...|.and a k|
|00005370| 65 79 20 69 73 20 70 72 | 65 73 73 65 64 2e 0d 0d |ey is pr|essed...|
|00005380| 6d 6f 75 73 65 2d 64 6f | 77 6e 09 20 20 20 20 20 |mouse-do|wn. |
|00005390| 20 20 20 43 61 6c 6c 65 | 64 20 77 68 65 6e 65 76 | Calle|d whenev|
|000053a0| 65 72 20 74 68 65 20 6d | 6f 75 73 65 20 67 6f 65 |er the m|ouse goe|
|000053b0| 73 20 64 6f 77 6e 20 0d | 09 09 09 77 69 74 68 69 |s down .|...withi|
|000053c0| 6e 20 74 68 65 20 62 6f | 75 6e 64 73 20 6f 66 20 |n the bo|unds of |
|000053d0| 74 68 65 20 6f 62 6a 65 | 63 74 2e 0d 0d 6d 6f 75 |the obje|ct...mou|
|000053e0| 73 65 2d 75 70 09 09 43 | 61 6c 6c 65 64 20 77 68 |se-up..C|alled wh|
|000053f0| 65 6e 65 76 65 72 20 74 | 68 65 20 6d 6f 75 73 65 |enever t|he mouse|
|00005400| 20 67 6f 65 73 20 75 70 | 20 0d 09 09 09 77 69 74 | goes up| ....wit|
|00005410| 68 69 6e 20 74 68 65 20 | 62 6f 75 6e 64 73 20 6f |hin the |bounds o|
|00005420| 66 20 74 68 65 20 6f 62 | 6a 65 63 74 2e 0d 0d 41 |f the ob|ject...A|
|00005430| 6c 6c 20 6f 62 6a 65 63 | 74 73 20 77 69 6c 6c 20 |ll objec|ts will |
|00005440| 68 61 76 65 20 64 65 66 | 61 75 6c 74 20 68 61 6e |have def|ault han|
|00005450| 64 6c 65 72 73 20 74 68 | 61 74 20 64 6f 20 6e 6f |dlers th|at do no|
|00005460| 74 68 69 6e 67 2c 20 0d | 65 78 63 65 70 74 20 66 |thing, .|except f|
|00005470| 6f 72 20 74 68 65 20 77 | 69 6e 64 6f 77 d5 73 20 |or the w|indow.s |
|00005480| 69 64 6c 65 20 68 61 6e | 64 6c 65 72 2c 20 77 68 |idle han|dler, wh|
|00005490| 69 63 68 20 73 69 6d 70 | 6c 79 20 0d 70 61 73 73 |ich simp|ly .pass|
|000054a0| 65 73 20 74 68 65 20 69 | 64 6c 65 20 65 76 65 6e |es the i|dle even|
|000054b0| 74 20 74 6f 20 6f 62 6a | 65 63 74 73 20 69 6e 20 |t to obj|ects in |
|000054c0| 69 74 73 20 77 69 6e 64 | 6f 77 2e 0d 0d 57 65 d5 |its wind|ow...We.|
|000054d0| 6c 6c 20 64 65 66 69 6e | 65 20 61 20 73 65 74 20 |ll defin|e a set |
|000054e0| 6f 66 20 64 65 66 61 75 | 6c 74 20 68 61 6e 64 6c |of defau|lt handl|
|000054f0| 65 72 73 20 74 68 61 74 | 20 77 69 6c 6c 20 62 65 |ers that| will be|
|00005500| 20 0d 63 61 6c 6c 65 64 | 20 69 66 20 74 68 65 20 | .called| if the |
|00005510| 75 73 65 72 20 64 6f 65 | 73 20 6e 6f 74 20 77 72 |user doe|s not wr|
|00005520| 69 74 65 20 61 6e 79 20 | 73 63 72 69 70 74 73 20 |ite any |scripts |
|00005530| 66 6f 72 20 74 68 65 73 | 65 20 0d 68 61 6e 64 6c |for thes|e .handl|
|00005540| 65 72 73 2e 20 4d 6f 73 | 74 20 6f 66 20 74 68 65 |ers. Mos|t of the|
|00005550| 73 65 20 77 69 6c 6c 20 | 64 6f 20 6e 6f 74 68 69 |se will |do nothi|
|00005560| 6e 67 2e 20 48 65 72 65 | 2c 20 77 65 20 0d 69 6d |ng. Here|, we .im|
|00005570| 70 6c 65 6d 65 6e 74 20 | 74 68 65 20 69 64 6c 65 |plement |the idle|
|00005580| 20 64 65 66 61 75 6c 74 | 20 68 61 6e 64 6c 65 72 | default| handler|
|00005590| 20 66 6f 72 20 74 68 65 | 20 64 72 61 77 2d 0d 64 | for the| draw-.d|
|000055a0| 69 61 6c 6f 67 20 63 6c | 61 73 73 3a 0d 0d 28 64 |ialog cl|ass:..(d|
|000055b0| 65 66 6d 65 74 68 6f 64 | 20 69 64 6c 65 20 28 28 |efmethod| idle ((|
|000055c0| 74 68 69 73 2d 77 69 6e | 64 6f 77 20 64 72 61 77 |this-win|dow draw|
|000055d0| 2d 64 69 61 6c 6f 67 29 | 29 0d 20 20 28 64 6f 6c |-dialog)|). (dol|
|000055e0| 69 73 74 20 28 69 74 65 | 6d 20 28 73 6c 6f 74 2d |ist (ite|m (slot-|
|000055f0| 76 61 6c 75 65 20 74 68 | 69 73 2d 77 69 6e 64 6f |value th|is-windo|
|00005600| 77 20 27 6d 79 2d 69 74 | 65 6d 73 29 29 0d 20 20 |w 'my-it|ems)). |
|00005610| 20 20 28 69 64 6c 65 20 | 69 74 65 6d 29 29 29 0d | (idle |item))).|
|00005620| 0d 54 68 69 73 20 6d 65 | 74 68 6f 64 20 73 69 6d |.This me|thod sim|
|00005630| 70 6c 79 20 73 65 6e 64 | 73 20 61 6e 20 69 64 6c |ply send|s an idl|
|00005640| 65 20 6d 65 73 73 61 67 | 65 20 74 6f 20 65 61 63 |e messag|e to eac|
|00005650| 68 20 69 74 65 6d 20 0d | 69 6e 20 74 68 65 20 6d |h item .|in the m|
|00005660| 79 2d 69 74 65 6d 20 73 | 6c 6f 74 20 6f 66 20 74 |y-item s|lot of t|
|00005670| 68 65 20 77 69 6e 64 6f | 77 2e 20 28 4e 6f 74 65 |he windo|w. (Note|
|00005680| 20 68 6f 77 20 65 61 73 | 69 6c 79 20 0d 77 65 20 | how eas|ily .we |
|00005690| 68 61 76 65 20 62 65 65 | 6e 20 61 62 6c 65 20 6e |have bee|n able n|
|000056a0| 6f 74 20 6f 6e 6c 79 20 | 74 6f 20 74 61 6c 6b 20 |ot only |to talk |
|000056b0| 61 62 6f 75 74 20 62 75 | 74 20 61 6c 73 6f 20 74 |about bu|t also t|
|000056c0| 6f 20 0d 73 68 6f 77 20 | 68 6f 77 20 77 65 20 63 |o .show |how we c|
|000056d0| 61 6e 20 63 6f 6e 74 72 | 6f 6c 20 74 68 65 20 69 |an contr|ol the i|
|000056e0| 74 65 6d 73 20 69 6e 20 | 6f 75 72 20 64 72 61 67 |tems in |our drag|
|000056f0| 2d 64 69 61 6c 6f 67 20 | 0d 77 69 6e 64 6f 77 73 |-dialog |.windows|
|00005700| 20 77 69 74 68 6f 75 74 | 20 68 61 76 69 6e 67 20 | without| having |
|00005710| 64 65 66 69 6e 65 64 20 | 74 68 65 20 6f 62 6a 65 |defined |the obje|
|00005720| 63 74 73 20 0d 74 68 65 | 6d 73 65 6c 76 65 73 21 |cts .the|mselves!|
|00005730| 20 54 68 69 73 20 77 69 | 6c 6c 20 62 65 20 6d 6f | This wi|ll be mo|
|00005740| 72 65 20 64 72 61 6d 61 | 74 69 63 61 6c 6c 79 20 |re drama|tically |
|00005750| 63 6c 65 61 72 20 61 73 | 20 0d 77 65 20 70 72 6f |clear as| .we pro|
|00005760| 63 65 65 64 20 74 6f 20 | 70 72 6f 76 69 64 65 20 |ceed to |provide |
|00005770| 74 68 65 20 65 76 65 6e | 74 2d 68 61 6e 64 6c 69 |the even|t-handli|
|00005780| 6e 67 20 6d 61 63 68 69 | 6e 65 72 79 20 0d 74 68 |ng machi|nery .th|
|00005790| 61 74 20 64 72 69 76 65 | 73 20 61 6c 6c 20 6f 66 |at drive|s all of|
|000057a0| 20 74 68 65 20 65 76 65 | 6e 74 73 20 61 62 6f 76 | the eve|nts abov|
|000057b0| 65 2e 29 0d 0d 54 68 69 | 73 20 69 73 20 61 20 73 |e.)..Thi|s is a s|
|000057c0| 69 6d 70 6c 65 20 6d 65 | 74 68 6f 64 20 64 65 66 |imple me|thod def|
|000057d0| 69 6e 69 74 69 6f 6e 2e | 20 49 74 73 20 6e 61 6d |inition.| Its nam|
|000057e0| 65 20 69 73 20 69 64 6c | 65 20 61 6e 64 20 0d 69 |e is idl|e and .i|
|000057f0| 74 20 68 61 73 20 6f 6e | 6c 79 20 6f 6e 65 20 66 |t has on|ly one f|
|00005800| 6f 72 6d 61 6c 20 61 72 | 67 75 6d 65 6e 74 3a 20 |ormal ar|gument: |
|00005810| 61 6e 20 69 6e 73 74 61 | 6e 63 65 20 6f 66 20 61 |an insta|nce of a|
|00005820| 20 0d 64 72 61 77 2d 64 | 69 61 6c 6f 67 20 63 6c | .draw-d|ialog cl|
|00005830| 61 73 73 2e 20 44 75 72 | 69 6e 67 20 74 68 65 20 |ass. Dur|ing the |
|00005840| 65 78 65 63 75 74 69 6f | 6e 20 6f 66 20 74 68 65 |executio|n of the|
|00005850| 20 0d 6d 65 74 68 6f 64 | 2c 20 74 68 69 73 20 69 | .method|, this i|
|00005860| 6e 73 74 61 6e 63 65 20 | 69 73 20 62 6f 75 6e 64 |nstance |is bound|
|00005870| 20 74 6f 20 74 68 65 20 | 6c 6f 63 61 6c 20 76 61 | to the |local va|
|00005880| 72 69 61 62 6c 65 20 0d | 74 68 69 73 2d 77 69 6e |riable .|this-win|
|00005890| 64 6f 77 2e 20 49 6e 20 | 6d 61 6e 79 20 6f 74 68 |dow. In |many oth|
|000058a0| 65 72 20 6f 62 6a 65 63 | 74 2d 62 61 73 65 64 20 |er objec|t-based |
|000058b0| 6c 61 6e 67 75 61 67 65 | 73 2c 20 0d 74 68 69 73 |language|s, .this|
|000058c0| 20 76 61 72 69 61 62 6c | 65 20 69 73 20 63 61 6c | variabl|e is cal|
|000058d0| 6c 65 64 20 73 65 6c 66 | 2c 20 62 75 74 20 69 6e |led self|, but in|
|000058e0| 20 43 6f 6d 6d 6f 6e 20 | 4c 69 73 70 20 69 74 20 | Common |Lisp it |
|000058f0| 6d 75 73 74 20 0d 62 65 | 20 65 78 70 6c 69 63 69 |must .be| explici|
|00005900| 74 6c 79 20 62 6f 75 6e | 64 20 74 6f 20 61 20 76 |tly boun|d to a v|
|00005910| 61 72 69 61 62 6c 65 20 | 69 6e 20 74 68 65 20 66 |ariable |in the f|
|00005920| 6f 72 6d 61 6c 20 0d 61 | 72 67 75 6d 65 6e 74 20 |ormal .a|rgument |
|00005930| 6c 69 73 74 2e 20 57 68 | 79 3f 20 42 65 63 61 75 |list. Wh|y? Becau|
|00005940| 73 65 2c 20 61 73 20 77 | 65 20 6d 65 6e 74 69 6f |se, as w|e mentio|
|00005950| 6e 65 64 20 65 61 72 6c | 69 65 72 2c 20 0d 61 20 |ned earl|ier, .a |
|00005960| 43 6f 6d 6d 6f 6e 20 4c | 69 73 70 20 6d 65 74 68 |Common L|isp meth|
|00005970| 6f 64 20 77 69 6c 6c 20 | 6c 6f 6f 6b 20 61 74 20 |od will |look at |
|00005980| 74 68 65 20 63 6c 61 73 | 73 20 6f 66 20 65 76 65 |the clas|s of eve|
|00005990| 72 79 20 0d 61 72 67 75 | 6d 65 6e 74 20 70 61 73 |ry .argu|ment pas|
|000059a0| 73 65 64 20 74 6f 20 69 | 74 20 62 65 66 6f 72 65 |sed to i|t before|
|000059b0| 20 64 65 63 69 64 69 6e | 67 20 77 68 69 63 68 20 | decidin|g which |
|000059c0| 66 75 6e 63 74 69 6f 6e | 20 0d 74 6f 20 63 61 6c |function| .to cal|
|000059d0| 6c 2e 20 54 68 75 73 2c | 20 74 68 65 72 65 20 69 |l. Thus,| there i|
|000059e0| 73 6e d5 74 20 61 6e 79 | 20 64 69 73 74 69 6e 67 |sn.t any| disting|
|000059f0| 75 69 73 68 65 64 20 73 | 65 6c 66 2c 20 62 75 74 |uished s|elf, but|
|00005a00| 20 0d 72 61 74 68 65 72 | 20 6d 61 6e 79 20 73 65 | .rather| many se|
|00005a10| 6c 76 65 73 20 63 6f 6d | 70 65 74 69 6e 67 20 66 |lves com|peting f|
|00005a20| 6f 72 20 69 64 65 6e 74 | 69 74 79 68 6f 6f 64 21 |or ident|ityhood!|
|00005a30| 0d 0d 41 6e 6f 74 68 65 | 72 20 74 68 69 6e 67 20 |..Anothe|r thing |
|00005a40| 74 6f 20 6e 6f 74 69 63 | 65 20 69 6e 20 69 64 6c |to notic|e in idl|
|00005a50| 65 20 69 73 20 68 6f 77 | 20 61 20 73 6c 6f 74 20 |e is how| a slot |
|00005a60| 6f 66 20 74 68 65 20 0d | 6f 62 6a 65 63 74 20 69 |of the .|object i|
|00005a70| 73 20 61 63 63 65 73 73 | 65 64 2e 20 54 68 65 20 |s access|ed. The |
|00005a80| 63 6f 6e 73 74 72 75 63 | 74 0d 0d 28 73 6c 6f 74 |construc|t..(slot|
|00005a90| 2d 76 61 6c 75 65 20 3c | 6f 62 6a 65 63 74 3e 20 |-value <|object> |
|00005aa0| 3c 73 6c 6f 74 2d 6e 61 | 6d 65 3e 29 0d 0d 69 73 |<slot-na|me>)..is|
|00005ab0| 20 74 68 65 20 64 65 66 | 61 75 6c 74 20 77 61 79 | the def|ault way|
|00005ac0| 20 74 6f 20 72 65 66 65 | 72 20 74 6f 20 61 6e 20 | to refe|r to an |
|00005ad0| 6f 62 6a 65 63 74 d5 73 | 20 73 6c 6f 74 20 76 61 |object.s| slot va|
|00005ae0| 6c 75 65 2e 20 0d 48 6f | 77 65 76 65 72 2c 20 74 |lue. .Ho|wever, t|
|00005af0| 68 65 20 3a 61 63 63 65 | 73 73 6f 72 20 6f 70 74 |he :acce|ssor opt|
|00005b00| 69 6f 6e 20 6f 66 20 64 | 65 66 63 6c 61 73 73 20 |ion of d|efclass |
|00005b10| 65 6e 61 62 6c 65 73 20 | 79 6f 75 20 0d 74 6f 20 |enables |you .to |
|00005b20| 64 65 66 69 6e 65 20 68 | 6f 77 20 79 6f 75 20 77 |define h|ow you w|
|00005b30| 61 6e 74 20 74 6f 20 6e | 61 6d 65 20 74 68 65 20 |ant to n|ame the |
|00005b40| 73 6c 6f 74 20 61 63 63 | 65 73 73 6f 72 2e 20 46 |slot acc|essor. F|
|00005b50| 6f 72 20 0d 65 78 61 6d | 70 6c 65 3a 0d 0d 28 64 |or .exam|ple:..(d|
|00005b60| 65 66 63 6c 61 73 73 20 | 70 65 72 73 6f 6e 0d 20 |efclass |person. |
|00005b70| 20 28 28 61 67 65 20 3a | 69 6e 69 74 66 6f 72 6d | ((age :|initform|
|00005b80| 20 32 30 0d 20 20 20 20 | 20 20 20 20 3a 61 63 63 | 20. | :acc|
|00005b90| 65 73 73 6f 72 20 61 67 | 65 29 29 29 0d 0d 65 6e |essor ag|e)))..en|
|00005ba0| 61 62 6c 65 73 20 79 6f | 75 20 74 6f 20 61 63 63 |ables yo|u to acc|
|00005bb0| 65 73 73 20 74 68 65 20 | 61 67 65 20 73 6c 6f 74 |ess the |age slot|
|00005bc0| 20 6f 66 20 61 6e 20 69 | 6e 73 74 61 6e 63 65 20 | of an i|nstance |
|00005bd0| 78 20 6f 66 20 0d 70 65 | 72 73 6f 6e 20 76 69 61 |x of .pe|rson via|
|00005be0| 20 74 68 65 20 65 78 70 | 72 65 73 73 69 6f 6e 20 | the exp|ression |
|00005bf0| 28 61 67 65 20 78 29 2e | 20 4e 61 6d 65 64 20 61 |(age x).| Named a|
|00005c00| 63 63 65 73 73 6f 72 73 | 20 0d 68 61 76 65 20 74 |ccessors| .have t|
|00005c10| 68 65 20 76 69 72 74 75 | 65 20 6f 66 20 68 69 64 |he virtu|e of hid|
|00005c20| 69 6e 67 20 74 68 65 20 | 6f 62 6a 65 63 74 20 73 |ing the |object s|
|00005c30| 79 73 74 65 6d 20 61 6e | 64 20 61 72 65 20 0d 65 |ystem an|d are .e|
|00005c40| 6e 63 6f 75 72 61 67 65 | 64 2e 20 48 6f 77 65 76 |ncourage|d. Howev|
|00005c50| 65 72 2c 20 77 65 20 77 | 69 6c 6c 20 63 6f 6e 73 |er, we w|ill cons|
|00005c60| 69 73 74 65 6e 74 6c 79 | 20 75 73 65 20 73 6c 6f |istently| use slo|
|00005c70| 74 2d 0d 76 61 6c 75 65 | 20 74 6f 20 61 63 63 65 |t-.value| to acce|
|00005c80| 73 73 20 73 6c 6f 74 20 | 76 61 6c 75 65 73 20 69 |ss slot |values i|
|00005c90| 6e 20 6f 72 64 65 72 20 | 74 6f 20 63 6c 61 72 69 |n order |to clari|
|00005ca0| 66 79 20 6f 75 72 20 75 | 73 65 20 0d 6f 66 20 6f |fy our u|se .of o|
|00005cb0| 62 6a 65 63 74 20 73 6c | 6f 74 73 20 69 6e 20 6f |bject sl|ots in o|
|00005cc0| 75 72 20 74 75 74 6f 72 | 69 61 6c 2e 0d 0d 4e 65 |ur tutor|ial...Ne|
|00005cd0| 78 74 2c 20 77 65 20 77 | 61 6e 74 20 74 6f 20 64 |xt, we w|ant to d|
|00005ce0| 72 69 76 65 20 74 68 65 | 20 65 76 65 6e 74 20 73 |rive the| event s|
|00005cf0| 79 73 74 65 6d 2e 20 46 | 72 6f 6d 20 77 68 65 72 |ystem. F|rom wher|
|00005d00| 65 3f 20 0d 55 6e 6c 69 | 6b 65 20 69 6e 20 6f 74 |e? .Unli|ke in ot|
|00005d10| 68 65 72 20 4d 61 63 69 | 6e 74 6f 73 68 20 70 72 |her Maci|ntosh pr|
|00005d20| 6f 67 72 61 6d 6d 69 6e | 67 20 65 6e 76 69 72 6f |ogrammin|g enviro|
|00005d30| 6e 6d 65 6e 74 73 2c 20 | 0d 77 68 65 6e 20 77 65 |nments, |.when we|
|00005d40| 20 77 72 69 74 65 20 61 | 20 4c 69 73 70 20 70 72 | write a| Lisp pr|
|00005d50| 6f 67 72 61 6d 20 77 65 | 20 61 72 65 20 6e 6f 74 |ogram we| are not|
|00005d60| 20 72 65 73 70 6f 6e 73 | 69 62 6c 65 20 0d 66 6f | respons|ible .fo|
|00005d70| 72 20 63 61 6c 6c 69 6e | 67 20 57 61 69 74 4e 65 |r callin|g WaitNe|
|00005d80| 78 74 45 76 65 6e 74 2e | 20 46 6f 72 74 75 6e 61 |xtEvent.| Fortuna|
|00005d90| 74 65 6c 79 2c 20 74 68 | 65 20 4d 43 4c 20 0d 77 |tely, th|e MCL .w|
|00005da0| 69 6e 64 6f 77 20 63 6c | 61 73 73 20 68 61 73 20 |indow cl|ass has |
|00005db0| 61 20 70 72 65 64 65 66 | 69 6e 65 64 20 6d 65 74 |a predef|ined met|
|00005dc0| 68 6f 64 20 63 61 6c 6c | 65 64 20 0d 77 69 6e 64 |hod call|ed .wind|
|00005dd0| 6f 77 2d 6e 75 6c 6c 2d | 65 76 65 6e 74 2d 68 61 |ow-null-|event-ha|
|00005de0| 6e 64 6c 65 72 20 74 68 | 61 74 20 69 73 20 70 65 |ndler th|at is pe|
|00005df0| 72 69 6f 64 69 63 61 6c | 6c 79 20 0d 63 61 6c 6c |riodical|ly .call|
|00005e00| 65 64 20 62 79 20 4d 43 | 4c 3b 20 69 6e 20 70 61 |ed by MC|L; in pa|
|00005e10| 72 74 69 63 75 6c 61 72 | 2c 20 61 66 74 65 72 20 |rticular|, after |
|00005e20| 65 61 63 68 20 0d 57 61 | 69 74 4e 65 78 74 45 76 |each .Wa|itNextEv|
|00005e30| 65 6e 74 20 69 73 20 70 | 72 6f 63 65 73 73 65 64 |ent is p|rocessed|
|00005e40| 2e 20 4d 43 4c 20 77 69 | 6c 6c 20 61 70 70 6c 79 |. MCL wi|ll apply|
|00005e50| 20 74 68 69 73 20 0d 6d | 65 74 68 6f 64 20 74 6f | this .m|ethod to|
|00005e60| 20 61 6e 79 20 61 63 74 | 69 76 65 20 69 6e 73 74 | any act|ive inst|
|00005e70| 61 6e 63 65 20 6f 66 20 | 61 20 77 69 6e 64 6f 77 |ance of |a window|
|00005e80| 20 63 6c 61 73 73 20 6f | 66 20 0d 77 68 69 63 68 | class o|f .which|
|00005e90| 20 69 74 20 69 73 20 61 | 77 61 72 65 2e 20 54 68 | it is a|ware. Th|
|00005ea0| 69 73 20 69 6e 63 6c 75 | 64 65 73 20 61 6c 6c 20 |is inclu|des all |
|00005eb0| 69 6e 73 74 61 6e 63 65 | 73 20 6f 66 20 0d 64 72 |instance|s of .dr|
|00005ec0| 61 77 2d 64 69 61 6c 6f | 67 2c 20 73 69 6e 63 65 |aw-dialo|g, since|
|00005ed0| 20 74 68 65 20 6c 61 74 | 74 65 72 20 69 73 20 61 | the lat|ter is a|
|00005ee0| 20 73 75 62 63 6c 61 73 | 73 20 6f 66 20 0d 77 69 | subclas|s of .wi|
|00005ef0| 6e 64 6f 77 2c 20 67 69 | 76 69 6e 67 20 75 73 20 |ndow, gi|ving us |
|00005f00| 6f 6e 65 20 6f 66 20 74 | 68 65 20 68 6f 6f 6b 73 |one of t|he hooks|
|00005f10| 20 77 65 20 6e 65 65 64 | 65 64 2e 20 4c 65 74 d5 | we need|ed. Let.|
|00005f20| 73 20 0d 64 65 66 69 6e | 65 20 77 69 6e 64 6f 77 |s .defin|e window|
|00005f30| 2d 6e 75 6c 6c 2d 65 76 | 65 6e 74 2d 68 61 6e 64 |-null-ev|ent-hand|
|00005f40| 6c 65 72 20 66 6f 72 20 | 64 72 61 77 2d 64 69 61 |ler for |draw-dia|
|00005f50| 6c 6f 67 20 0d 74 6f 20 | 68 61 6e 64 6c 65 20 74 |log .to |handle t|
|00005f60| 68 65 20 65 76 65 6e 74 | 20 74 72 61 66 66 69 63 |he event| traffic|
|00005f70| 20 61 73 20 66 6f 6c 6c | 6f 77 73 3a 0d 0d 28 64 | as foll|ows:..(d|
|00005f80| 65 66 6d 65 74 68 6f 64 | 20 77 69 6e 64 6f 77 2d |efmethod| window-|
|00005f90| 6e 75 6c 6c 2d 65 76 65 | 6e 74 2d 68 61 6e 64 6c |null-eve|nt-handl|
|00005fa0| 65 72 20 28 28 77 20 64 | 72 61 77 2d 64 69 61 6c |er ((w d|raw-dial|
|00005fb0| 6f 67 29 29 0d 20 20 28 | 6c 65 74 2a 20 28 28 77 |og)). (|let* ((w|
|00005fc0| 68 65 72 65 20 28 76 69 | 65 77 2d 6d 6f 75 73 65 |here (vi|ew-mouse|
|00005fd0| 2d 70 6f 73 69 74 69 6f | 6e 20 77 29 29 20 20 20 |-positio|n w)) |
|00005fe0| 3b 20 57 69 6e 64 6f 77 | 20 63 6f 6f 72 64 69 6e |; Window| coordin|
|00005ff0| 61 74 65 20 70 6f 69 6e | 74 20 6f 66 20 6d 6f 75 |ate poin|t of mou|
|00006000| 73 65 0d 20 20 20 20 20 | 20 20 20 20 28 69 74 65 |se. | (ite|
|00006010| 6d 20 28 66 69 6e 64 2d | 76 69 65 77 2d 63 6f 6e |m (find-|view-con|
|00006020| 74 61 69 6e 69 6e 67 2d | 70 6f 69 6e 74 20 77 20 |taining-|point w |
|00006030| 28 70 6f 69 6e 74 2d 68 | 20 77 68 65 72 65 29 20 |(point-h| where) |
|00006040| 28 70 6f 69 6e 74 2d 76 | 20 77 68 65 72 65 29 29 |(point-v| where))|
|00006050| 29 0d 20 20 20 20 20 20 | 20 20 20 28 6c 61 73 74 |). | (last|
|00006060| 2d 75 6e 64 65 72 2d 6d | 6f 75 73 65 20 28 73 6c |-under-m|ouse (sl|
|00006070| 6f 74 2d 76 61 6c 75 65 | 20 77 20 27 69 74 65 6d |ot-value| w 'item|
|00006080| 2d 6c 61 73 74 2d 75 6e | 64 65 72 2d 6d 6f 75 73 |-last-un|der-mous|
|00006090| 65 29 29 29 0d 20 20 20 | 20 3b 3b 20 48 61 6e 64 |e))). | ;; Hand|
|000060a0| 6c 65 20 6d 6f 75 73 65 | 2d 77 69 74 68 69 6e 2c |le mouse|-within,|
|000060b0| 20 6d 6f 75 73 65 2d 65 | 6e 74 65 72 20 61 6e 64 | mouse-e|nter and|
|000060c0| 20 6d 6f 75 73 65 2d 6c | 65 61 76 65 20 65 76 65 | mouse-l|eave eve|
|000060d0| 6e 74 73 0d 20 20 20 20 | 28 77 68 65 6e 20 28 61 |nts. |(when (a|
|000060e0| 6e 64 20 28 73 6c 6f 74 | 2d 76 61 6c 75 65 20 77 |nd (slot|-value w|
|000060f0| 20 27 62 72 6f 77 73 65 | 2d 6d 6f 64 65 29 20 20 | 'browse|-mode) |
|00006100| 20 20 3b 20 69 6e 20 62 | 72 6f 77 73 65 72 20 6d | ; in b|rowser m|
|00006110| 6f 64 65 20 61 6e 64 0d | 20 20 20 20 20 20 20 20 |ode and.| |
|00006120| 20 20 20 20 20 20 20 69 | 74 65 6d 29 20 20 20 20 | i|tem) |
|00006130| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00006140| 20 20 20 20 20 20 3b 20 | 77 68 65 6e 20 6d 6f 75 | ; |when mou|
|00006150| 73 65 20 69 73 20 6f 76 | 65 72 20 61 6e 20 69 74 |se is ov|er an it|
|00006160| 65 6d 0d 20 20 20 20 20 | 20 28 63 6f 6e 64 20 28 |em. | (cond (|
|00006170| 28 65 71 20 6c 61 73 74 | 2d 75 6e 64 65 72 2d 6d |(eq last|-under-m|
|00006180| 6f 75 73 65 20 69 74 65 | 6d 29 0d 20 20 20 20 20 |ouse ite|m). |
|00006190| 20 20 20 20 20 20 20 20 | 28 6d 6f 75 73 65 2d 77 | |(mouse-w|
|000061a0| 69 74 68 69 6e 20 69 74 | 65 6d 20 77 68 65 72 65 |ithin it|em where|
|000061b0| 29 29 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 28 |)). | (|
|000061c0| 74 20 28 69 66 20 6c 61 | 73 74 2d 75 6e 64 65 72 |t (if la|st-under|
|000061d0| 2d 6d 6f 75 73 65 0d 20 | 20 20 20 20 20 20 20 20 |-mouse. | |
|000061e0| 20 20 20 20 20 20 20 20 | 28 6d 6f 75 73 65 2d 6c | |(mouse-l|
|000061f0| 65 61 76 65 20 6c 61 73 | 74 2d 75 6e 64 65 72 2d |eave las|t-under-|
|00006200| 6d 6f 75 73 65 20 77 68 | 65 72 65 29 29 0d 20 20 |mouse wh|ere)). |
|00006210| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 28 73 65 | | (se|
|00006220| 74 66 20 28 73 6c 6f 74 | 2d 76 61 6c 75 65 20 77 |tf (slot|-value w|
|00006230| 20 27 69 74 65 6d 2d 6c | 61 73 74 2d 75 6e 64 65 | 'item-l|ast-unde|
|00006240| 72 2d 6d 6f 75 73 65 29 | 20 69 74 65 6d 29 0d 20 |r-mouse)| item). |
|00006250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 28 6d | | (m|
|00006260| 6f 75 73 65 2d 65 6e 74 | 65 72 20 69 74 65 6d 20 |ouse-ent|er item |
|00006270| 77 68 65 72 65 29 29 29 | 0d 20 20 20 20 20 20 3b |where)))|. ;|
|00006280| 3b 20 48 61 6e 64 6c 65 | 20 69 64 6c 65 20 65 76 |; Handle| idle ev|
|00006290| 65 6e 74 20 66 6f 72 20 | 77 69 6e 64 6f 77 0d 20 |ent for |window. |
|000062a0| 20 20 20 20 20 28 69 64 | 6c 65 20 77 29 29 29 0d | (id|le w))).|
|000062b0| 20 20 28 63 61 6c 6c 2d | 6e 65 78 74 2d 6d 65 74 | (call-|next-met|
|000062c0| 68 6f 64 29 29 0d 0d 48 | 65 72 65 2c 20 77 65 20 |hod))..H|ere, we |
|000062d0| 62 6f 75 6e 64 20 74 68 | 65 20 76 61 72 69 61 62 |bound th|e variab|
|000062e0| 6c 65 20 77 20 74 6f 20 | 74 68 65 20 69 6e 73 74 |le w to |the inst|
|000062f0| 61 6e 63 65 20 6f 66 20 | 74 68 65 20 0d 64 72 61 |ance of |the .dra|
|00006300| 77 2d 64 69 61 6c 6f 67 | 20 77 69 6e 64 6f 77 20 |w-dialog| window |
|00006310| 74 6f 20 77 68 69 63 68 | 20 74 68 65 20 6d 65 73 |to which| the mes|
|00006320| 73 61 67 65 20 77 61 73 | 20 73 65 6e 74 2e 20 0d |sage was| sent. .|
|00006330| 54 68 65 20 6c 65 74 2a | 20 73 74 61 74 65 6d 65 |The let*| stateme|
|00006340| 6e 74 20 63 72 65 61 74 | 65 73 20 74 68 65 20 66 |nt creat|es the f|
|00006350| 6f 6c 6c 6f 77 69 6e 67 | 20 6c 6f 63 61 6c 20 0d |ollowing| local .|
|00006360| 76 61 72 69 61 62 6c 65 | 73 3a 0d 0d 77 68 65 72 |variable|s:..wher|
|00006370| 65 09 54 68 65 20 63 75 | 72 72 65 6e 74 20 6c 6f |e.The cu|rrent lo|
|00006380| 63 61 74 69 6f 6e 20 6f | 66 20 74 68 65 20 6d 6f |cation o|f the mo|
|00006390| 75 73 65 20 61 73 20 61 | 0d 09 70 6f 69 6e 74 2e |use as a|..point.|
|000063a0| 0d 0d 69 74 65 6d 09 54 | 68 65 20 69 74 65 6d 20 |..item.T|he item |
|000063b0| 28 65 69 74 68 65 72 20 | 74 68 65 20 77 69 6e 64 |(either |the wind|
|000063c0| 6f 77 20 6f 72 20 61 6e | 20 69 74 65 6d 0d 09 69 |ow or an| item..i|
|000063d0| 6e 20 74 68 65 20 77 69 | 6e 64 6f 77 29 20 75 6e |n the wi|ndow) un|
|000063e0| 64 65 72 20 74 68 65 20 | 6d 6f 75 73 65 2e 0d 0d |der the |mouse...|
|000063f0| 6c 61 73 74 2d 75 6e 64 | 65 72 2d 6d 6f 75 73 65 |last-und|er-mouse|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.